shiyunteng
2026-10-23 c5ea85558fea4d82b5368073c598a30f905c4bdc
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java
@@ -1,29 +1,37 @@
package com.by4cloud.platformx.business.service.impl;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.by4cloud.platformx.admin.api.entity.SysDept;
import com.by4cloud.platformx.admin.api.entity.SysDictItem;
import com.by4cloud.platformx.admin.api.feign.RemoteDeptService;
import com.by4cloud.platformx.admin.api.feign.RemoteDictService;
import com.by4cloud.platformx.business.dto.AgingQueryDTO;
import com.by4cloud.platformx.business.dto.AnalysisCommonDTO;
import com.by4cloud.platformx.business.entity.BusinessCustomer;
import com.by4cloud.platformx.business.mapper.BusinessCustomerMapper;
import com.by4cloud.platformx.business.mapper.ContractMapper;
import com.by4cloud.platformx.business.mapper.ContractPaymentScheduleMapper;
import com.by4cloud.platformx.business.dto.HomeQueryDTO;
import com.by4cloud.platformx.business.entity.*;
import com.by4cloud.platformx.business.mapper.*;
import com.by4cloud.platformx.business.service.StatisticService;
import com.by4cloud.platformx.business.vo.*;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.datascope.DataScope;
import com.by4cloud.platformx.common.security.util.SecurityUtils;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@@ -34,6 +42,13 @@
   private final ContractMapper contractMapper;
   private final ContractPaymentScheduleMapper contractPaymentScheduleMapper;
   private final BusinessCustomerMapper businessCustomerMapper;
   private final PaymentSlipMapper paymentSlipMapper;
   private final ContractOutBoundMapper contractOutBoundMapper;
   private final ContractInvoiceMapper contractInvoiceMapper;
   private final CurrentOverdueMapper currentOverdueMapper;
   private final HistoryOverdueMapper historyOverdueMapper;
   private final AnnualPlanMapper annualPlanMapper;
   private final PaymentReceiveMapper paymentReceiveMapper;
   private final RemoteDeptService remoteDeptService;
   private final RemoteDictService remoteDictService;
@@ -56,7 +71,6 @@
   public R contractAmountAnalysis(AnalysisCommonDTO commonDTO) {
      List<Long> compIds = new ArrayList<>();
      compIds.add(Long.valueOf(sgb));
      compIds.add(Long.valueOf(smj));
      compIds.add(Long.valueOf(tfgs));
      compIds.add(Long.valueOf(ymj));
      compIds.add(Long.valueOf(jxc));
@@ -79,7 +93,7 @@
      compIds.add(Long.valueOf(ymj));
      compIds.add(Long.valueOf(jxc));
      List<ContractIncomeAnalysisVo> contractIncomeAnalysisVoList = contractMapper.contractIncomeAnalysis(commonDTO,compIds);
      if (ArrayUtil.isNotEmpty(contractIncomeAnalysisVoList.toArray())){
      if (CollUtil.isNotEmpty(contractIncomeAnalysisVoList)){
         contractIncomeAnalysisVoList.stream().forEach(contractIncomeAnalysisVo -> {
            if(StrUtil.equals(contractIncomeAnalysisVo.getCompId(),sgb)){
               contractIncomeAnalysisVo.setCompName("石工泵");
@@ -111,7 +125,7 @@
   public R contractAmountAnalysisByArea(AnalysisCommonDTO commonDTO) {
      R<List<SysDictItem>> r = remoteDictService.getDictByType("company_area");
      List<SysDictItem> items = r.getData();
      if (ArrayUtil.isEmpty(items.toArray())){
      if (CollUtil.isEmpty(items)){
         return R.failed("地区字典分类获取异常");
      }
      List<Long> compIds = new ArrayList<>();
@@ -151,7 +165,7 @@
   public R contractAmountAnalysisByIndustry(AnalysisCommonDTO commonDTO) {
      R<List<SysDictItem>> r = remoteDictService.getDictByType("industry_sector");
      List<SysDictItem> items = r.getData();
      if (ArrayUtil.isEmpty(items.toArray())){
      if (CollUtil.isEmpty(items)){
         return R.failed("行业字典分类获取异常");
      }
      List<Long> compIds = new ArrayList<>();
@@ -191,7 +205,7 @@
   public R contractAmountAnalysisByMarket(AnalysisCommonDTO commonDTO) {
      R<List<SysDictItem>> r = remoteDictService.getDictByType("market_type");
      List<SysDictItem> items = r.getData();
      if (ArrayUtil.isEmpty(items.toArray())){
      if (CollUtil.isEmpty(items)){
         return R.failed("市场类型字典分类获取异常");
      }
      List<Long> compIds = new ArrayList<>();
@@ -231,7 +245,7 @@
   public R contractAmountAnalysisBySpcBus(AnalysisCommonDTO commonDTO) {
      R<List<SysDictItem>> r = remoteDictService.getDictByType("supply_attribute");
      List<SysDictItem> items = r.getData();
      if (ArrayUtil.isEmpty(items.toArray())){
      if (CollUtil.isEmpty(items)){
         return R.failed("供应属性字典分类获取异常");
      }
      List<Long> compIds = new ArrayList<>();
@@ -271,7 +285,7 @@
   public R contractAmountAnalysisByExportBus(AnalysisCommonDTO commonDTO) {
      R<List<SysDictItem>> r = remoteDictService.getDictByType("export_attr");
      List<SysDictItem> items = r.getData();
      if (ArrayUtil.isEmpty(items.toArray())){
      if (CollUtil.isEmpty(items)){
         return R.failed("区域字段获取异常");
      }
      List<Long> compIds = new ArrayList<>();
@@ -312,7 +326,7 @@
   public R contractAmountAnalysisBySaleModel(AnalysisCommonDTO commonDTO) {
      R<List<SysDictItem>> r = remoteDictService.getDictByType("sales_model");
      List<SysDictItem> items = r.getData();
      if (ArrayUtil.isEmpty(items.toArray())){
      if (CollUtil.isEmpty(items)){
         return R.failed("销售模式字典分类获取异常");
      }
      List<Long> compIds = new ArrayList<>();
@@ -353,30 +367,40 @@
   public R agingAnalysisByArea(AnalysisCommonDTO commonDTO) {
      R<List<SysDictItem>> r = remoteDictService.getDictByType("company_area");
      List<SysDictItem> items = r.getData();
      if (ArrayUtil.isEmpty(items.toArray())){
      if (CollUtil.isEmpty(items)){
         return R.failed("地区字典分类获取异常");
      }
//      List<AgingCompanyVo> companys = contractPaymentScheduleMapper.selectAgingCompany(DataScope.of("comp_id"));
//      if (ArrayUtil.isEmpty(companys.toArray())){
//      if (CollUtil.isEmpty(companys)){
//         return R.failed("暂无账龄");
//      }
      List<Long> compIds = new ArrayList<>();
      compIds.add(Long.valueOf(sgb));
      compIds.add(Long.valueOf(smj));
      compIds.add(Long.valueOf(tfgs));
      compIds.add(Long.valueOf(ymj));
      compIds.add(Long.valueOf(jxc));
      List<AgingAnalysisVo> result = new ArrayList<>();
      AgingQueryDTO queryDTO = new AgingQueryDTO();
      List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotal(null);
      if (CollUtil.contains(compIds,SecurityUtils.getUser().getCompId())){
         queryDTO.setCompanyId(SecurityUtils.getUser().getCompId());
      }
      List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotal(queryDTO);
      items.stream().forEach(item->{
         AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
         agingAnalysisVo.setCompanyName(item.getLabel());
         queryDTO.setAreaId(item.getItemValue());
         List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotal(queryDTO);
         //补全数据
         if (ArrayUtil.isEmpty(companyAgingVo.toArray())){
         if (CollUtil.isEmpty(companyAgingVo)){
            companyAgingVo = new ArrayList<>();
            AgingVo agingVo1 = new AgingVo("0-30天",new BigDecimal("0"),null);
            AgingVo agingVo2 = new AgingVo("31-60天",new BigDecimal("0"),null);
            AgingVo agingVo3 = new AgingVo("61-90天",new BigDecimal("0"),null);
            AgingVo agingVo4 = new AgingVo("91-180天",new BigDecimal("0"),null);
            AgingVo agingVo5 = new AgingVo("181-365天",new BigDecimal("0"),null);
            AgingVo agingVo6 = new AgingVo("1年以上",new BigDecimal("0"),null);
            AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
            AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
            AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
            AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
            AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
            AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
            companyAgingVo.add(agingVo1);
            companyAgingVo.add(agingVo2);
            companyAgingVo.add(agingVo3);
@@ -385,31 +409,32 @@
            companyAgingVo.add(agingVo6);
         }else {
            List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
            if (!ArrayUtil.contains(overdueRanges.toArray(),"0-30天")){
               AgingVo agingVo1 = new AgingVo("0-30天",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"0-30天")){
               AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo1);
            }
            if (!ArrayUtil.contains(overdueRanges.toArray(),"31-60天")){
               AgingVo agingVo2 = new AgingVo("31-60天",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"31-60天")){
               AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo2);
            }
            if (!ArrayUtil.contains(overdueRanges.toArray(),"61-90天")){
               AgingVo agingVo3 = new AgingVo("61-90天",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"61-90天")){
               AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo3);
            }
            if (!ArrayUtil.contains(overdueRanges.toArray(),"91-180天")){
               AgingVo agingVo4 = new AgingVo("91-180天",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"91-180天")){
               AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo4);
            }
            if (!ArrayUtil.contains(overdueRanges.toArray(),"181-365天")){
               AgingVo agingVo5 = new AgingVo("181-365天",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"181-365天")){
               AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo5);
            }
            if (!ArrayUtil.contains(overdueRanges.toArray(),"1年以上")){
               AgingVo agingVo6 = new AgingVo("1年以上",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"1年以上")){
               AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo6);
            }
         }
         companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
         agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
         List<AgingVo> finalCompanyAgingVo = companyAgingVo;
         agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
@@ -449,26 +474,37 @@
   public R agingAnalysisByIndustry(AnalysisCommonDTO commonDTO) {
      R<List<SysDictItem>> r = remoteDictService.getDictByType("industry_sector");
      List<SysDictItem> items = r.getData();
      if (ArrayUtil.isEmpty(items.toArray())){
         return R.failed("地区字典分类获取异常");
      if (CollUtil.isEmpty(items)){
         return R.failed("行业字典分类获取异常");
      }
      List<Long> compIds = new ArrayList<>();
      compIds.add(Long.valueOf(smj));
      compIds.add(Long.valueOf(sgb));
      compIds.add(Long.valueOf(jxc));
      compIds.add(Long.valueOf(tfgs));
      compIds.add(Long.valueOf(ymj));
      List<AgingAnalysisVo> result = new ArrayList<>();
      AgingQueryDTO queryDTO = new AgingQueryDTO();
      List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotal(null);
      if (CollUtil.contains(compIds,SecurityUtils.getUser().getCompId())){
         queryDTO.setCompanyId(SecurityUtils.getUser().getCompId());
      }
      List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotal(queryDTO);
      items.stream().forEach(item->{
         AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
         agingAnalysisVo.setCompanyName(item.getLabel());
         queryDTO.setIndustryId(item.getItemValue());
         List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotal(queryDTO);
         //补全数据
         if (ArrayUtil.isEmpty(companyAgingVo.toArray())){
         if (CollUtil.isEmpty(companyAgingVo)){
            companyAgingVo = new ArrayList<>();
            AgingVo agingVo1 = new AgingVo("0-30天",new BigDecimal("0"),null);
            AgingVo agingVo2 = new AgingVo("31-60天",new BigDecimal("0"),null);
            AgingVo agingVo3 = new AgingVo("61-90天",new BigDecimal("0"),null);
            AgingVo agingVo4 = new AgingVo("91-180天",new BigDecimal("0"),null);
            AgingVo agingVo5 = new AgingVo("181-365天",new BigDecimal("0"),null);
            AgingVo agingVo6 = new AgingVo("1年以上",new BigDecimal("0"),null);
            AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
            AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
            AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
            AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
            AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
            AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
            companyAgingVo.add(agingVo1);
            companyAgingVo.add(agingVo2);
            companyAgingVo.add(agingVo3);
@@ -477,31 +513,32 @@
            companyAgingVo.add(agingVo6);
         }else {
            List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
            if (!ArrayUtil.contains(overdueRanges.toArray(),"0-30天")){
               AgingVo agingVo1 = new AgingVo("0-30天",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"0-30天")){
               AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo1);
            }
            if (!ArrayUtil.contains(overdueRanges.toArray(),"31-60天")){
               AgingVo agingVo2 = new AgingVo("31-60天",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"31-60天")){
               AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo2);
            }
            if (!ArrayUtil.contains(overdueRanges.toArray(),"61-90天")){
               AgingVo agingVo3 = new AgingVo("61-90天",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"61-90天")){
               AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo3);
            }
            if (!ArrayUtil.contains(overdueRanges.toArray(),"91-180天")){
               AgingVo agingVo4 = new AgingVo("91-180天",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"91-180天")){
               AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo4);
            }
            if (!ArrayUtil.contains(overdueRanges.toArray(),"181-365天")){
               AgingVo agingVo5 = new AgingVo("181-365天",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"181-365天")){
               AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo5);
            }
            if (!ArrayUtil.contains(overdueRanges.toArray(),"1年以上")){
               AgingVo agingVo6 = new AgingVo("1年以上",new BigDecimal("0"),null);
            if (!CollUtil.contains(overdueRanges,"1年以上")){
               AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo6);
            }
         }
         companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
         agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
         List<AgingVo> finalCompanyAgingVo = companyAgingVo;
         agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
@@ -540,34 +577,74 @@
   @Override
   public R agingAnalysis(AnalysisCommonDTO commonDTO) {
      if (commonDTO.getAgingType().equals("2")) {
         AgingQueryDTO queryDTO = new AgingQueryDTO();
         List<AgingCompanyVo> companys = contractPaymentScheduleMapper.selectAgingCompanyShip(DataScope.of("comp_id"));
         if (ArrayUtil.isEmpty(companys.toArray())) {
            return R.failed("暂无账龄");
         }
         //合计数据
         List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotalShip(queryDTO);
         agingVoList = completeData(agingVoList);
         List<AgingVo> finalAgingVoList = agingVoList;
         List<Long> compIds = new ArrayList<>();
         compIds.add(Long.valueOf(smj));
         compIds.add(Long.valueOf(sgb));
         compIds.add(Long.valueOf(jxc));
         compIds.add(Long.valueOf(tfgs));
         compIds.add(Long.valueOf(ymj));
         List<AgingAnalysisVo> result = new ArrayList<>();
         companys.stream().forEach(company -> {
            BusinessCustomer businessCustomer = businessCustomerMapper.selectById(company.getCompanyId());
         AgingQueryDTO queryDTO = new AgingQueryDTO();
         List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotalShip(null);
         compIds.stream().forEach(compId->{
            R<SysDept> r = remoteDeptService.getById(compId);
            if (!r.isOk()){
               return;
            }
            SysDept dept = r.getData();
            AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
            agingAnalysisVo.setCompanyName(businessCustomer.getCompanyName());
            queryDTO.setCompanyId(company.getCompanyId());
            agingAnalysisVo.setCompanyName(dept.getName());
            queryDTO.setCompanyId(dept.getDeptId());
            List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotalShip(queryDTO);
            //补全数据
            companyAgingVo = completeData(companyAgingVo);
            if (CollUtil.isEmpty(companyAgingVo)){
               companyAgingVo = new ArrayList<>();
               AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
               AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
               AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
               AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
               AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
               AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo1);
               companyAgingVo.add(agingVo2);
               companyAgingVo.add(agingVo3);
               companyAgingVo.add(agingVo4);
               companyAgingVo.add(agingVo5);
               companyAgingVo.add(agingVo6);
            }else {
               List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
               if (!CollUtil.contains(overdueRanges,"0-30天")){
                  AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo1);
               }
               if (!CollUtil.contains(overdueRanges,"31-60天")){
                  AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo2);
               }
               if (!CollUtil.contains(overdueRanges,"61-90天")){
                  AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo3);
               }
               if (!CollUtil.contains(overdueRanges,"91-180天")){
                  AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo4);
               }
               if (!CollUtil.contains(overdueRanges,"181-365天")){
                  AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo5);
               }
               if (!CollUtil.contains(overdueRanges,"1年以上")){
                  AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo6);
               }
            }
            companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
            agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
            List<AgingVo> finalCompanyAgingVo = companyAgingVo;
            agingAnalysisVo.setPercent(IntStream.range(0, finalAgingVoList.size())
            agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
                  .mapToObj(i -> {
                     BigDecimal part = finalCompanyAgingVo.get(i).getTotalAmount();
                     BigDecimal total = finalAgingVoList.get(i).getTotalAmount();
                     BigDecimal total = agingVoList.get(i).getTotalAmount();
                     if (total == null || total.compareTo(BigDecimal.ZERO) == 0) {
                        return null;
                     }
@@ -587,7 +664,7 @@
                  if (agingAnalysisVo.getAmount().get(i) == null || agingAnalysisVo.getAmount().get(i).compareTo(BigDecimal.ZERO) == 0) {
                     return null;
                  } else {
                  }else {
                     return new BigDecimal("100");
                  }
               })
@@ -597,33 +674,74 @@
         return R.ok(result);
      }
      if (commonDTO.getAgingType().equals("3")) {
         AgingQueryDTO queryDTO = new AgingQueryDTO();
         List<AgingCompanyVo> companys = contractPaymentScheduleMapper.selectAgingCompanyInvoice(DataScope.of("comp_id"));
         if (ArrayUtil.isEmpty(companys.toArray())) {
            return R.failed("暂无账龄");
         }
         //合计数据
         List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotalInvoice(queryDTO);
         agingVoList = completeData(agingVoList);
         List<AgingVo> finalAgingVoList = agingVoList;
         List<Long> compIds = new ArrayList<>();
         compIds.add(Long.valueOf(sgb));
         compIds.add(Long.valueOf(smj));
         compIds.add(Long.valueOf(tfgs));
         compIds.add(Long.valueOf(ymj));
         compIds.add(Long.valueOf(jxc));
         List<AgingAnalysisVo> result = new ArrayList<>();
         companys.stream().forEach(company -> {
            BusinessCustomer businessCustomer = businessCustomerMapper.selectById(company.getCompanyId());
         AgingQueryDTO queryDTO = new AgingQueryDTO();
         List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotalInvoice(null);
         compIds.stream().forEach(compId->{
            R<SysDept> r = remoteDeptService.getById(compId);
            if (!r.isOk()){
               return;
            }
            SysDept dept = r.getData();
            AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
            agingAnalysisVo.setCompanyName(businessCustomer.getCompanyName());
            queryDTO.setCompanyId(company.getCompanyId());
            agingAnalysisVo.setCompanyName(dept.getName());
            queryDTO.setCompanyId(dept.getDeptId());
            List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotalInvoice(queryDTO);
            //补全数据
            companyAgingVo = completeData(companyAgingVo);
            if (CollUtil.isEmpty(companyAgingVo)){
               companyAgingVo = new ArrayList<>();
               AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
               AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
               AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
               AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
               AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
               AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo1);
               companyAgingVo.add(agingVo2);
               companyAgingVo.add(agingVo3);
               companyAgingVo.add(agingVo4);
               companyAgingVo.add(agingVo5);
               companyAgingVo.add(agingVo6);
            }else {
               List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
               if (!CollUtil.contains(overdueRanges,"0-30天")){
                  AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo1);
               }
               if (!CollUtil.contains(overdueRanges,"31-60天")){
                  AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo2);
               }
               if (!CollUtil.contains(overdueRanges,"61-90天")){
                  AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo3);
               }
               if (!CollUtil.contains(overdueRanges,"91-180天")){
                  AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo4);
               }
               if (!CollUtil.contains(overdueRanges,"181-365天")){
                  AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo5);
               }
               if (!CollUtil.contains(overdueRanges,"1年以上")){
                  AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
                  companyAgingVo.add(agingVo6);
               }
            }
            companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
            agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
            List<AgingVo> finalCompanyAgingVo = companyAgingVo;
            agingAnalysisVo.setPercent(IntStream.range(0, finalAgingVoList.size())
            agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
                  .mapToObj(i -> {
                     BigDecimal part = finalCompanyAgingVo.get(i).getTotalAmount();
                     BigDecimal total = finalAgingVoList.get(i).getTotalAmount();
                     BigDecimal total = agingVoList.get(i).getTotalAmount();
                     if (total == null || total.compareTo(BigDecimal.ZERO) == 0) {
                        return null;
                     }
@@ -643,7 +761,7 @@
                  if (agingAnalysisVo.getAmount().get(i) == null || agingAnalysisVo.getAmount().get(i).compareTo(BigDecimal.ZERO) == 0) {
                     return null;
                  } else {
                  }else {
                     return new BigDecimal("100");
                  }
               })
@@ -655,48 +773,997 @@
      return R.ok();
   }
   private List<AgingVo> completeData(List<AgingVo> companyAgingVo) {
      if (ArrayUtil.isEmpty(companyAgingVo.toArray())) {
         companyAgingVo = new ArrayList<>();
         AgingVo agingVo1 = new AgingVo("0-30天", new BigDecimal("0"), null);
         AgingVo agingVo2 = new AgingVo("31-60天", new BigDecimal("0"), null);
         AgingVo agingVo3 = new AgingVo("61-90天", new BigDecimal("0"), null);
         AgingVo agingVo4 = new AgingVo("91-180天", new BigDecimal("0"), null);
         AgingVo agingVo5 = new AgingVo("181-365天", new BigDecimal("0"), null);
         AgingVo agingVo6 = new AgingVo("1年以上", new BigDecimal("0"), null);
         companyAgingVo.add(agingVo1);
         companyAgingVo.add(agingVo2);
         companyAgingVo.add(agingVo3);
         companyAgingVo.add(agingVo4);
         companyAgingVo.add(agingVo5);
         companyAgingVo.add(agingVo6);
      } else {
         List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
         if (!ArrayUtil.contains(overdueRanges.toArray(), "0-30天")) {
            AgingVo agingVo1 = new AgingVo("0-30天", new BigDecimal("0"), null);
   @Override
   public R agingAnalysisByMarket(AnalysisCommonDTO commonDTO) {
      R<List<SysDictItem>> r = remoteDictService.getDictByType("market_type");
      List<SysDictItem> items = r.getData();
      if (CollUtil.isEmpty(items)){
         return R.failed("市场类型字典分类获取异常");
      }
      List<AgingAnalysisVo> result = new ArrayList<>();
      AgingQueryDTO queryDTO = new AgingQueryDTO();
      List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotal(null);
      items.stream().forEach(item->{
         AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
         agingAnalysisVo.setCompanyName(item.getLabel());
         queryDTO.setClassId(item.getItemValue());
         List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotal(queryDTO);
         //补全数据
         if (CollUtil.isEmpty(companyAgingVo)){
            companyAgingVo = new ArrayList<>();
            AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
            AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
            AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
            AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
            AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
            AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
            companyAgingVo.add(agingVo1);
         }
         if (!ArrayUtil.contains(overdueRanges.toArray(), "31-60天")) {
            AgingVo agingVo2 = new AgingVo("31-60天", new BigDecimal("0"), null);
            companyAgingVo.add(agingVo2);
         }
         if (!ArrayUtil.contains(overdueRanges.toArray(), "61-90天")) {
            AgingVo agingVo3 = new AgingVo("61-90天", new BigDecimal("0"), null);
            companyAgingVo.add(agingVo3);
         }
         if (!ArrayUtil.contains(overdueRanges.toArray(), "91-180天")) {
            AgingVo agingVo4 = new AgingVo("91-180天", new BigDecimal("0"), null);
            companyAgingVo.add(agingVo4);
         }
         if (!ArrayUtil.contains(overdueRanges.toArray(), "181-365天")) {
            AgingVo agingVo5 = new AgingVo("181-365天", new BigDecimal("0"), null);
            companyAgingVo.add(agingVo5);
         }
         if (!ArrayUtil.contains(overdueRanges.toArray(), "1年以上")) {
            AgingVo agingVo6 = new AgingVo("1年以上", new BigDecimal("0"), null);
            companyAgingVo.add(agingVo6);
         }else {
            List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
            if (!CollUtil.contains(overdueRanges,"0-30天")){
               AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo1);
            }
            if (!CollUtil.contains(overdueRanges,"31-60天")){
               AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo2);
            }
            if (!CollUtil.contains(overdueRanges,"61-90天")){
               AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo3);
            }
            if (!CollUtil.contains(overdueRanges,"91-180天")){
               AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo4);
            }
            if (!CollUtil.contains(overdueRanges,"181-365天")){
               AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo5);
            }
            if (!CollUtil.contains(overdueRanges,"1年以上")){
               AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo6);
            }
         }
         companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
         agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
         List<AgingVo> finalCompanyAgingVo = companyAgingVo;
         agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
               .mapToObj(i -> {
                  BigDecimal part = finalCompanyAgingVo.get(i).getTotalAmount();
                  BigDecimal total = agingVoList.get(i).getTotalAmount();
                  if (total == null || total.compareTo(BigDecimal.ZERO) == 0) {
                     return null;
                  }
                  return part.divide(total, 4, RoundingMode.HALF_UP)
                        .multiply(new BigDecimal("100"))
                        .setScale(2, RoundingMode.HALF_UP);
               })
               .collect(Collectors.toList()));
         result.add(agingAnalysisVo);
      });
      //合计
      AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
      agingAnalysisVo.setCompanyName("合计");
      agingAnalysisVo.setAmount(agingVoList.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
      List<BigDecimal> percent = IntStream.range(0, agingAnalysisVo.getAmount().size())
            .mapToObj(i -> {
               if (agingAnalysisVo.getAmount().get(i) == null || agingAnalysisVo.getAmount().get(i).compareTo(BigDecimal.ZERO) == 0) {
                  return null;
               }else {
                  return new BigDecimal("100");
               }
            })
            .collect(Collectors.toList());
      agingAnalysisVo.setPercent(percent);
      result.add(agingAnalysisVo);
      return R.ok(result);
   }
   @Override
   public R agingAnalysisTotalScale(AnalysisCommonDTO commonDTO) {
      List<Long> compIds = new ArrayList<>();
      compIds.add(Long.valueOf(smj));
      compIds.add(Long.valueOf(sgb));
      compIds.add(Long.valueOf(tfgs));
      compIds.add(Long.valueOf(jxc));
      compIds.add(Long.valueOf(ymj));
      List<AgingAnalysisVo> result = new ArrayList<>();
      AgingQueryDTO queryDTO = new AgingQueryDTO();
      List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotalScale(null);
      compIds.stream().forEach(compId->{
         R<SysDept> r = remoteDeptService.getById(compId);
         if (!r.isOk()){
            return;
         }
         SysDept dept = r.getData();
         AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
         agingAnalysisVo.setCompanyName(dept.getName());
         queryDTO.setCompanyId(dept.getDeptId());
         List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotalScale(queryDTO);
         //补全数据
         if (CollUtil.isEmpty(companyAgingVo)){
            companyAgingVo = new ArrayList<>();
            AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
            AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
            AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
            AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
            AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
            AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
            companyAgingVo.add(agingVo1);
            companyAgingVo.add(agingVo2);
            companyAgingVo.add(agingVo3);
            companyAgingVo.add(agingVo4);
            companyAgingVo.add(agingVo5);
            companyAgingVo.add(agingVo6);
         }else {
            List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
            if (!CollUtil.contains(overdueRanges,"0-30天")){
               AgingVo agingVo1 = new AgingVo(1L,"0-30天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo1);
            }
            if (!CollUtil.contains(overdueRanges,"31-60天")){
               AgingVo agingVo2 = new AgingVo(2L,"31-60天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo2);
            }
            if (!CollUtil.contains(overdueRanges,"61-90天")){
               AgingVo agingVo3 = new AgingVo(3L,"61-90天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo3);
            }
            if (!CollUtil.contains(overdueRanges,"91-180天")){
               AgingVo agingVo4 = new AgingVo(4L,"91-180天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo4);
            }
            if (!CollUtil.contains(overdueRanges,"181-365天")){
               AgingVo agingVo5 = new AgingVo(5L,"181-365天",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo5);
            }
            if (!CollUtil.contains(overdueRanges,"1年以上")){
               AgingVo agingVo6 = new AgingVo(6L,"1年以上",new BigDecimal("0"),null);
               companyAgingVo.add(agingVo6);
            }
         }
         companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
         agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
         List<AgingVo> finalCompanyAgingVo = companyAgingVo;
         agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
               .mapToObj(i -> {
                  BigDecimal part = finalCompanyAgingVo.get(i).getTotalAmount();
                  BigDecimal total = agingVoList.get(i).getTotalAmount();
                  if (total == null || total.compareTo(BigDecimal.ZERO) == 0) {
                     return null;
                  }
                  return part.divide(total, 4, RoundingMode.HALF_UP)
                        .multiply(new BigDecimal("100"))
                        .setScale(2, RoundingMode.HALF_UP);
               })
               .collect(Collectors.toList()));
         result.add(agingAnalysisVo);
      });
      //合计
      AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
      agingAnalysisVo.setCompanyName("合计");
      agingAnalysisVo.setAmount(agingVoList.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
      List<BigDecimal> percent = IntStream.range(0, agingAnalysisVo.getAmount().size())
            .mapToObj(i -> {
               if (agingAnalysisVo.getAmount().get(i) == null || agingAnalysisVo.getAmount().get(i).compareTo(BigDecimal.ZERO) == 0) {
                  return null;
               }else {
                  return new BigDecimal("100");
               }
            })
            .collect(Collectors.toList());
      agingAnalysisVo.setPercent(percent);
      result.add(agingAnalysisVo);
      return R.ok(result);
   }
   @Override
   public R homeZbjt() {
      List<HomeZbjtVo> homeZbjtVoList = new ArrayList<>();
      //出货
//      HomeZbjtVo ch = contractOutBoundMapper.homeZbjt();
//      homeZbjtVoList.add(ch);
      //只保留销售收入 回款 新增合同
      //开票
      HomeZbjtVo kp = contractInvoiceMapper.homeZbjt();
      homeZbjtVoList.add(kp);
      //回款
      HomeZbjtVo hk = paymentSlipMapper.homeZbjt();
      homeZbjtVoList.add(hk);
      //合同签订 sgb smj jxc tfgs ymj
      HomeZbjtVo htqd = contractMapper.homeZbjt();
      homeZbjtVoList.add(htqd);
      //赊销产生值 今天发货加今天开票额
//      if (ObjUtil.isNotNull(ch)&&ObjUtil.isNotNull(kp)){
//         HomeZbjtVo sxsy = ch.add(kp);
//         homeZbjtVoList.add(sxsy);
//      }else if (ObjUtil.isNotNull(ch)&&ObjUtil.isNull(kp)){
//         homeZbjtVoList.add(ch);
//      }else if (ObjUtil.isNull(ch)&&ObjUtil.isNotNull(kp)){
//         homeZbjtVoList.add(kp);
//      }else {
//         homeZbjtVoList.add(new HomeZbjtVo());
//      }
      //赊销累计剩余值 今日发货且没开票的出货
//      HomeZbjtVo sx = contractOutBoundMapper.homeZbjtSX();
//      homeZbjtVoList.add(sx);
//      HomeZbjtVo yq = currentOverdueMapper.homeZbjt();
//      //逾期累计剩余 今日产生逾期 含历史
//      HomeZbjtVo ls = historyOverdueMapper.homeZbjt();
//      if (ObjUtil.isNotNull(ls)&&ObjUtil.isNotNull(yq)){
//         homeZbjtVoList.add(yq.add(ls));
//      }else if (ObjUtil.isNotNull(ls)&&ObjUtil.isNull(yq)){
//         homeZbjtVoList.add(ls);
//      }else if (ObjUtil.isNull(ls)&&ObjUtil.isNotNull(yq)){
//         homeZbjtVoList.add(yq);
//      }else {
//         homeZbjtVoList.add(new HomeZbjtVo());
//      }
//      //逾期产生值 今天产生-今天已付
//
//      homeZbjtVoList.add(yq);
      return R.ok(homeZbjtVoList);
   }
   @Override
   public R homeZgs() {
      List<HomeZgsVo> homeZbjtVoList = new ArrayList<>();
//      //出货
//      HomeZgsVo ch = contractOutBoundMapper.homeZgs(SecurityUtils.getUser().getCompId());
//      homeZbjtVoList.add(ch);
      //开票
      HomeZgsVo kp = contractInvoiceMapper.homeZgs(SecurityUtils.getUser().getCompId());
      homeZbjtVoList.add(kp);
      //回款
      HomeZgsVo hk = paymentSlipMapper.homeZgs(SecurityUtils.getUser().getCompId());
      homeZbjtVoList.add(hk);
      //合同签订 华北  西北  东北  海外
      HomeZgsVo htqd = contractMapper.homeZgs(SecurityUtils.getUser().getCompId());
      homeZbjtVoList.add(htqd);
      //赊销产生值
//      if (ObjUtil.isNotNull(ch)&&ObjUtil.isNotNull(kp)){
//         HomeZgsVo sxsy = ch.add(kp);
//         homeZbjtVoList.add(sxsy);
//      }else if (ObjUtil.isNotNull(ch)&&ObjUtil.isNull(kp)){
//         homeZbjtVoList.add(ch);
//      }else if (ObjUtil.isNull(ch)&&ObjUtil.isNotNull(kp)){
//         homeZbjtVoList.add(kp);
//      }else {
//         homeZbjtVoList.add(new HomeZgsVo());
//      }
      //赊销累计剩余值
//      HomeZgsVo sx = contractOutBoundMapper.homeZgsSX(SecurityUtils.getUser().getCompId());
//      homeZbjtVoList.add(sx);
//
//      HomeZgsVo yq = currentOverdueMapper.homeZgs(SecurityUtils.getUser().getCompId());
//
//      //逾期产生值
//      HomeZgsVo ls = historyOverdueMapper.homeZgs(SecurityUtils.getUser().getCompId());
//      if (ObjUtil.isNotNull(ls)&&ObjUtil.isNotNull(yq)){
//         homeZbjtVoList.add(yq.add(ls));
//      }else if (ObjUtil.isNotNull(ls)&&ObjUtil.isNull(yq)){
//         homeZbjtVoList.add(ls);
//      }else if (ObjUtil.isNull(ls)&&ObjUtil.isNotNull(yq)){
//         homeZbjtVoList.add(yq);
//      }else {
//         homeZbjtVoList.add(new HomeZgsVo());
//      }
//      //逾期累计剩余
//      homeZbjtVoList.add(yq);
      return R.ok(homeZbjtVoList);
   }
   @Override
   public R homeZbjtFlag() {
      Long userId = SecurityUtils.getUser().getCompId();
      List<Long> compIds = new ArrayList<>();
      compIds.add(Long.valueOf(sgb));
      compIds.add(Long.valueOf(smj));
      compIds.add(Long.valueOf(tfgs));
      compIds.add(Long.valueOf(ymj));
      compIds.add(Long.valueOf(jxc));
      if (compIds.contains(userId)){
         return R.ok(false);
      };
      return R.ok(true);
   }
   @Override
   public R homeContract(HomeQueryDTO queryDTO) {
      LocalDateTime now = LocalDateTime.now();
      LocalDate today = now.toLocalDate();
      // 开始时间:今天 00:00:00
      LocalDateTime startOfDay = today.atStartOfDay();
      // 结束时间:今天 23:59:59.999999999 (或者使用 nextDay 00:00:00 配合 lt)
      LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
      // --- 场景二:查询当月数据 ---
      // 开始时间:当月1号 00:00:00
      LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
      // 结束时间:当月最后一天 23:59:59
      LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
      // 开始时间:当年1月1号 00:00:00
      LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
      // 结束时间:当年12月31号 23:59:59
      LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
      MPJLambdaWrapper<Contract> wrapper = new MPJLambdaWrapper<Contract>()
      .selectAll(Contract.class)
            .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,Contract::getPartyAId)
            .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),Contract::getSignDate,startOfDay)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),Contract::getSignDate,endOfDay)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),Contract::getSignDate,startOfMonth)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),Contract::getSignDate,endOfMonth)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),Contract::getSignDate,startOfYear)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),Contract::getSignDate,endOfYear)
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
            .orderByDesc(Contract::getCreateTime)
            ;
      return R.ok(contractMapper.selectList(wrapper));
   }
   @Override
   public R homePaymentSlip(HomeQueryDTO queryDTO) {
      LocalDateTime now = LocalDateTime.now();
      LocalDate today = now.toLocalDate();
      // 开始时间:今天 00:00:00
      LocalDateTime startOfDay = today.atStartOfDay();
      // 结束时间:今天 23:59:59.999999999 (或者使用 nextDay 00:00:00 配合 lt)
      LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
      // --- 场景二:查询当月数据 ---
      // 开始时间:当月1号 00:00:00
      LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
      // 结束时间:当月最后一天 23:59:59
      LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
      // 开始时间:当年1月1号 00:00:00
      LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
      // 结束时间:当年12月31号 23:59:59
      LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
      MPJLambdaWrapper<PaymentSlip> wrapper = new MPJLambdaWrapper<PaymentSlip>()
            .selectAll(PaymentSlip.class)
            .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,PaymentSlip::getBusGuestId)
            .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),PaymentSlip::getPaymentTime,startOfDay)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),PaymentSlip::getPaymentTime,endOfDay)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),PaymentSlip::getPaymentTime,startOfMonth)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),PaymentSlip::getPaymentTime,endOfMonth)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),PaymentSlip::getPaymentTime,startOfYear)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),PaymentSlip::getPaymentTime,endOfYear)
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
            .orderByDesc(PaymentSlip::getCreateTime)
            ;
      return R.ok(paymentSlipMapper.selectList(wrapper));
   }
   @Override
   public R homeOutBound(HomeQueryDTO queryDTO) {
      LocalDateTime now = LocalDateTime.now();
      LocalDate today = now.toLocalDate();
      // 开始时间:今天 00:00:00
      LocalDateTime startOfDay = today.atStartOfDay();
      // 结束时间:今天 23:59:59.999999999 (或者使用 nextDay 00:00:00 配合 lt)
      LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
      // --- 场景二:查询当月数据 ---
      // 开始时间:当月1号 00:00:00
      LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
      // 结束时间:当月最后一天 23:59:59
      LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
      // 开始时间:当年1月1号 00:00:00
      LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
      // 结束时间:当年12月31号 23:59:59
      LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
      MPJLambdaWrapper<ContractOutBound> wrapper = new MPJLambdaWrapper<ContractOutBound>()
            .selectAll(ContractOutBound.class)
            .select(Contract::getContractNo)
            .selectAs(BusinessCustomer::getCompanyName,"busGuestName")
            .select(ContractSubjectMatter::getUnitPrice)
            .leftJoin(Contract.class,Contract::getId,ContractOutBound::getContractId)
            .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,ContractOutBound::getBusGuestId)
            .leftJoin(ContractSubjectMatter.class, on->
                  on.eq(ContractSubjectMatter::getContractId,ContractOutBound::getContractId)
                        .eq(ContractSubjectMatter::getMaterialCode,ContractOutBound::getSubjectMatterCode)
            )
            .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractOutBound::getOutBoundTime,startOfDay)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractOutBound::getOutBoundTime,endOfDay)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractOutBound::getOutBoundTime,startOfMonth)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractOutBound::getOutBoundTime,endOfMonth)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractOutBound::getOutBoundTime,startOfYear)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractOutBound::getOutBoundTime,endOfYear)
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
            .orderByDesc(ContractOutBound::getCreateTime)
            ;
      return R.ok(contractOutBoundMapper.selectJoinList(HomeOutBoundVo.class,wrapper));
   }
   @Override
   public R homeInvoice(HomeQueryDTO queryDTO) {
      LocalDateTime now = LocalDateTime.now();
      LocalDate today = now.toLocalDate();
      // 开始时间:今天 00:00:00
      LocalDateTime startOfDay = today.atStartOfDay();
      // 结束时间:今天 23:59:59.999999999 (或者使用 nextDay 00:00:00 配合 lt)
      LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
      // --- 场景二:查询当月数据 ---
      // 开始时间:当月1号 00:00:00
      LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
      // 结束时间:当月最后一天 23:59:59
      LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
      // 开始时间:当年1月1号 00:00:00
      LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
      // 结束时间:当年12月31号 23:59:59
      LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
      MPJLambdaWrapper<ContractInvoice> wrapper = new MPJLambdaWrapper<ContractInvoice>()
            .selectAll(ContractInvoice.class)
            .select(Contract::getContractNo)
            .selectAs(BusinessCustomer::getCompanyName,"busGuestName")
            .leftJoin(Contract.class,Contract::getId,ContractInvoice::getContractId)
            .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,Contract::getPartyAId)
            .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractInvoice::getInvoiceTime,startOfDay)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractInvoice::getInvoiceTime,endOfDay)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractInvoice::getInvoiceTime,startOfMonth)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractInvoice::getInvoiceTime,endOfMonth)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractInvoice::getInvoiceTime,startOfYear)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractInvoice::getInvoiceTime,endOfYear)
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
            .orderByDesc(ContractInvoice::getCreateTime)
            ;
      return R.ok(contractInvoiceMapper.selectJoinList(HomeInvoiceVo.class,wrapper));
   }
   @Override
   public R homeCreditSale(HomeQueryDTO queryDTO) {
      LocalDateTime now = LocalDateTime.now();
      LocalDate today = now.toLocalDate();
      // 开始时间:今天 00:00:00
      LocalDateTime startOfDay = today.atStartOfDay();
      // 结束时间:今天 23:59:59.999999999 (或者使用 nextDay 00:00:00 配合 lt)
      LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
      // --- 场景二:查询当月数据 ---
      // 开始时间:当月1号 00:00:00
      LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
      // 结束时间:当月最后一天 23:59:59
      LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
      // 开始时间:当年1月1号 00:00:00
      LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
      // 结束时间:当年12月31号 23:59:59
      LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
      MPJLambdaWrapper<ContractOutBound> wrapper = new MPJLambdaWrapper<ContractOutBound>()
            .selectAll(ContractOutBound.class)
            .select(Contract::getContractNo)
            .selectAs(BusinessCustomer::getCompanyName,"busGuestName")
            .select(ContractSubjectMatter::getUnitPrice)
            .leftJoin(Contract.class,Contract::getId,ContractOutBound::getContractId)
            .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,Contract::getPartyAId)
            .leftJoin(ContractSubjectMatter.class, on->
                  on.eq(ContractSubjectMatter::getContractId,ContractOutBound::getContractId)
                  .eq(ContractSubjectMatter::getMaterialCode,ContractOutBound::getSubjectMatterCode)
            )
            .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractOutBound::getOutBoundTime,startOfDay)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),ContractOutBound::getOutBoundTime,endOfDay)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractOutBound::getOutBoundTime,startOfMonth)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),ContractOutBound::getOutBoundTime,endOfMonth)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractOutBound::getOutBoundTime,startOfYear)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),ContractOutBound::getOutBoundTime,endOfYear)
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
            .orderByDesc(ContractOutBound::getCreateTime)
            ;
      return R.ok(contractOutBoundMapper.selectJoinList(HomeCreditSaleVo.class,wrapper));
   }
   @Override
   public R homeOverdue(HomeQueryDTO queryDTO) {
      LocalDateTime now = LocalDateTime.now();
      LocalDate today = now.toLocalDate();
      // 开始时间:今天 00:00:00
      LocalDateTime startOfDay = today.atStartOfDay();
      // 结束时间:今天 23:59:59.999999999 (或者使用 nextDay 00:00:00 配合 lt)
      LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
      // --- 场景二:查询当月数据 ---
      // 开始时间:当月1号 00:00:00
      LocalDateTime startOfMonth = today.withDayOfMonth(1).atStartOfDay();
      // 结束时间:当月最后一天 23:59:59
      LocalDateTime endOfMonth = today.withDayOfMonth(today.lengthOfMonth()).atTime(LocalTime.MAX);
      // 开始时间:当年1月1号 00:00:00
      LocalDateTime startOfYear = today.withDayOfYear(1).atStartOfDay();
      // 结束时间:当年12月31号 23:59:59
      LocalDateTime endOfYear = today.withDayOfYear(today.lengthOfYear()).atTime(LocalTime.MAX);
      MPJLambdaWrapper<CurrentOverdue> wrapper = new MPJLambdaWrapper<CurrentOverdue>()
            .selectAll(CurrentOverdue.class)
            .select(Contract::getContractNo)
            .selectAs(BusinessCustomer::getCompanyName,"busGuestName")
            .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,CurrentOverdue::getBusGuestId)
            .leftJoin(Contract.class,Contract::getId,CurrentOverdue::getContractId)
            .eq(ObjUtil.isNotNull(queryDTO.getQueryCompId()),Contract::getCompId,queryDTO.getQueryCompId())
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),CurrentOverdue::getContractExpirTime,startOfDay)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"1"),CurrentOverdue::getContractExpirTime,endOfDay)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),CurrentOverdue::getContractExpirTime,startOfMonth)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"2"),CurrentOverdue::getContractExpirTime,endOfMonth)
            .ge(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),CurrentOverdue::getContractExpirTime,startOfYear)
            .le(StrUtil.isNotEmpty(queryDTO.getQueryType())&&StrUtil.equals(queryDTO.getQueryType(),"3"),CurrentOverdue::getContractExpirTime,endOfYear)
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryArea()),BusinessCustomer::getAreaId,queryDTO.getQueryArea())
            .eq(StrUtil.isNotEmpty(queryDTO.getQueryServiceAttr()),BusinessCustomer::getExportServiceAttr,queryDTO.getQueryServiceAttr())
            .orderByDesc(CurrentOverdue::getCreateTime)
            ;
      return R.ok(currentOverdueMapper.selectJoinList(HomeOverdueVo.class,wrapper));
   }
   @Override
   public R homeOverdueHis(HomeQueryDTO queryDTO) {
      List<HomeOverdueStaVo> homeOverdueVos = new ArrayList<>();
      HomeOverdueStaVo current = currentOverdueMapper.selectCurrentOverdue(queryDTO);
      if (ObjUtil.isNotNull(current)){
         current.setOverdueType("当前");
         homeOverdueVos.add(current);
      }
      HomeOverdueStaVo history = historyOverdueMapper.selectHistoryOverdue(queryDTO);
      if (ObjUtil.isNotNull(history)){
         history.setOverdueType("历史");
         homeOverdueVos.add(history);
      }
      return R.ok(homeOverdueVos);
   }
   @Override
   public R homeZgsColum() {
      R<List<SysDictItem>> r = remoteDictService.getDictByType("province");
      List<SysDictItem> items = r.getData();
      if (CollUtil.isEmpty(items)){
         return R.failed("客商省份字典分类获取异常");
      }
      List<HomeZgsData> list = new ArrayList<>();
      List<String> contractProvinces = contractMapper.homeZgsColum(SecurityUtils.getUser().getCompId());
      if (CollUtil.isNotEmpty(contractProvinces)){
         contractProvinces.stream().forEach(province->{
            HomeZgsData homeZgsData = contractInvoiceMapper.homeZgsData(SecurityUtils.getUser().getCompId(),province);
            if (ObjUtil.isNotNull(homeZgsData)) {
               SysDictItem result = items.stream()
                     .filter(item -> item != null && province.equals(item.getItemValue()))
                     .findFirst()
                     .orElse(null);
               homeZgsData.setProvinceCode(province);
               if (ObjUtil.isNotNull(result)) {
                  homeZgsData.setProvinceName(result.getLabel());
               }
               list.add(homeZgsData);
            }
         });
         return R.ok(list);
      }
      return R.ok();
   }
   @Override
   public R zbjtStatistic() {
      List<ZbjtStatisticVo> statisticVoList = new ArrayList<>();
      String curYear = DateUtil.year(new Date())+"";
      String curMonth = DateUtil.month(new Date())+"";
      //合同
      ZbjtStatisticVo htVo = contractMapper.zbjtStatisticByContract();
      AnnualPlanTotalVo planListHt = annualPlanMapper.selectPlanYear(curYear,"1");
      if (ObjUtil.isNotNull(htVo)&&ObjUtil.isNotNull(planListHt)){
         BigDecimal monAmount = planListHt.getMonthAmount(curMonth);
         if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
            htVo.setBmwc(new BigDecimal(htVo.getBm()).multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
         }
         BigDecimal yearAmount = planListHt.getTotalAmount();
         if (ObjUtil.isNotNull(yearAmount)&&yearAmount.compareTo(new BigDecimal("0"))>0){
            htVo.setBnwc(new BigDecimal(htVo.getBn()).multiply(new BigDecimal("100")).divide(yearAmount,2,RoundingMode.HALF_UP)+"%");
         }
      }
      return companyAgingVo;
      statisticVoList.add(htVo);
      //开票
      ZbjtStatisticVo kpVo = contractInvoiceMapper.zbjtStatisticByInvoice();
      AnnualPlanTotalVo planListFP = annualPlanMapper.selectPlanYear(curYear,"2");
      if (ObjUtil.isNotNull(kpVo)&&ObjUtil.isNotNull(planListFP)){
         BigDecimal monAmount = planListFP.getMonthAmount(curMonth);
         if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
            kpVo.setBmwc(new BigDecimal(kpVo.getBm()).multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
         }
         BigDecimal yearAmount = planListFP.getTotalAmount();
         if (ObjUtil.isNotNull(yearAmount)&&yearAmount.compareTo(new BigDecimal("0"))>0){
            kpVo.setBnwc(new BigDecimal(kpVo.getBn()).multiply(new BigDecimal("100")).divide(yearAmount,2,RoundingMode.HALF_UP)+"%");
         }
      }
      statisticVoList.add(kpVo);
      //回款
      ZbjtStatisticVo hkVo = paymentSlipMapper.zbjtStatisticByPayment();
      AnnualPlanTotalVo planListHK = annualPlanMapper.selectPlanYear(curYear,"2");
      if (ObjUtil.isNotNull(hkVo)&&ObjUtil.isNotNull(planListHK)){
         BigDecimal monAmount = planListHK.getMonthAmount(curMonth);
         if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
            hkVo.setBmwc(new BigDecimal(hkVo.getBm()).multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
         }
         BigDecimal yearAmount = planListHK.getTotalAmount();
         if (ObjUtil.isNotNull(yearAmount)&&yearAmount.compareTo(new BigDecimal("0"))>0){
            hkVo.setBnwc(new BigDecimal(hkVo.getBn()).multiply(new BigDecimal("100")).divide(yearAmount,2,RoundingMode.HALF_UP)+"%");
         }
      }
      statisticVoList.add(hkVo);
      return R.ok(statisticVoList);
   }
   @Override
   public R zbjtStatisticContractAmount() {
      JSONObject jsonObject = new JSONObject();
      ZbjtStatisticByContractAmountVo hte = contractMapper.zbjtStatisticByContractAmount();
      jsonObject.put("hte",hte);
      ZbjtStatisticByContractAmountProVo htp = contractMapper.zbjtStatisticByContractAmountPro();
      jsonObject.put("cpbk",htp);
      ZbjtStatisticByContractAmountClassVo sc = contractMapper.zbjtStatisticByContractAmountClass();
      jsonObject.put("sczb",sc);
      ZbjtStatisticByContractAmountSupplyVo yw = contractMapper.zbjtStatisticByContractAmountSupply();
      jsonObject.put("ywzb",yw);
      ZbjtStatisticByContractAmountClassVo ys = contractMapper.zbjtStatisticByContractAmountYS();
      jsonObject.put("yszb",ys);
      return R.ok(jsonObject);
   }
   @Override
   public R zbjtIndicatorTrend() {
      JSONObject jsonObject = new JSONObject();
      Integer curYear = DateUtil.year(new Date());
      String startMon = (curYear-3)+"-01-01";
      String endMon = curYear+"-12-01";
      List<ZbjtIndicatorTrendVo> trendList = contractMapper.zbjtIndicatorTrend(startMon,endMon);
      JSONObject zbqs_ht = new JSONObject();
      zbqs_ht.put((curYear-3)+"",trendList.stream().filter(item->item.getYearMon().startsWith((curYear-3)+"")).collect(Collectors.toList()));
      zbqs_ht.put((curYear-2)+"",trendList.stream().filter(item->item.getYearMon().startsWith((curYear-2)+"")).collect(Collectors.toList()));
      zbqs_ht.put((curYear-1)+"",trendList.stream().filter(item->item.getYearMon().startsWith((curYear-1)+"")).collect(Collectors.toList()));
      zbqs_ht.put(curYear+"",trendList.stream().filter(item->item.getYearMon().startsWith(curYear+"")).collect(Collectors.toList()));
      jsonObject.put("zbqs-ht",zbqs_ht);
      List<ZbjtIndicatorTrendVo> trendInvoiceList = contractInvoiceMapper.zbjtIndicatorTrend(startMon,endMon);
      JSONObject zbqs_sr = new JSONObject();
      zbqs_sr.put((curYear-3)+"",trendInvoiceList.stream().filter(item->item.getYearMon().startsWith((curYear-3)+"")).collect(Collectors.toList()));
      zbqs_sr.put((curYear-2)+"",trendInvoiceList.stream().filter(item->item.getYearMon().startsWith((curYear-2)+"")).collect(Collectors.toList()));
      zbqs_sr.put((curYear-1)+"",trendInvoiceList.stream().filter(item->item.getYearMon().startsWith((curYear-1)+"")).collect(Collectors.toList()));
      zbqs_sr.put(curYear+"",trendInvoiceList.stream().filter(item->item.getYearMon().startsWith(curYear+"")).collect(Collectors.toList()));
      jsonObject.put("zbqs-sr",zbqs_sr);
      List<ZbjtIndicatorTrendVo> trendSlipList = paymentSlipMapper.zbjtIndicatorTrend(startMon,endMon);
      JSONObject zbqs_hs = new JSONObject();
      zbqs_hs.put((curYear-3)+"",trendSlipList.stream().filter(item->item.getYearMon().startsWith((curYear-3)+"")).collect(Collectors.toList()));
      zbqs_hs.put((curYear-2)+"",trendSlipList.stream().filter(item->item.getYearMon().startsWith((curYear-2)+"")).collect(Collectors.toList()));
      zbqs_hs.put((curYear-1)+"",trendSlipList.stream().filter(item->item.getYearMon().startsWith((curYear-1)+"")).collect(Collectors.toList()));
      zbqs_hs.put(curYear+"",trendSlipList.stream().filter(item->item.getYearMon().startsWith(curYear+"")).collect(Collectors.toList()));
      jsonObject.put("zbqs-hk",zbqs_hs);
      return R.ok(jsonObject);
   }
   @Override
   public R zbjtPlanAchieced() {
      String curYear = DateUtil.year(new Date())+"";
      JSONObject jsonObject = new JSONObject();
      JSONObject ht = new JSONObject();
      AnnualPlanTotalVo planListHt = annualPlanMapper.selectPlanYear(curYear,"1");
      List<ZbjtIndicatorTrendVo> trendVoList = contractMapper.zbjtPlanAchieced(null);
      if (ObjUtil.isNotNull(planListHt)&&CollUtil.isNotEmpty(trendVoList)){
         trendVoList.stream().forEach(trendVo->{
            BigDecimal monAmount = planListHt.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      ht.put("zb",trendVoList);
      List<Long> compIds = new ArrayList<>();
      compIds.add(2089995177814495234L);
      compIds.add(2089996921978040321L);
      compIds.add(2089997578009128962L);
      compIds.add(2101966257365045249L);
      AnnualPlan planListHtSMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .in(AnnualPlan::getCompId,compIds).last("limit 1"));
      List<ZbjtIndicatorTrendVo> smjtrendVoList = contractMapper.zbjtPlanAchiecedSmj();
      if (ObjUtil.isNotNull(planListHtSMJ)&&CollUtil.isNotEmpty(smjtrendVoList)){
         smjtrendVoList.stream().forEach(trendVo->{
            BigDecimal monAmount = planListHtSMJ.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      ht.put("smj",smjtrendVoList);
      AnnualPlan planListHtSGB = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556196124250113L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> sgbtrendVoList = contractMapper.zbjtPlanAchieced(2056556196124250113L);
      if (ObjUtil.isNotNull(planListHtSGB)&&CollUtil.isNotEmpty(sgbtrendVoList)){
         sgbtrendVoList.stream().forEach(trendVo->{
            BigDecimal monAmount = planListHtSGB.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      ht.put("sgb",sgbtrendVoList);
      AnnualPlan planListHTfgs = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556421857497090L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> tfgstrendVoList = contractMapper.zbjtPlanAchieced(2056556421857497090L);
      if (ObjUtil.isNotNull(planListHTfgs)&&CollUtil.isNotEmpty(tfgstrendVoList)){
         tfgstrendVoList.stream().forEach(trendVo->{
            BigDecimal monAmount = planListHTfgs.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      ht.put("tfgs",tfgstrendVoList);
      AnnualPlan planListHjxc = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556317461270529L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> jxctrendVoList = contractMapper.zbjtPlanAchieced(2056556317461270529L);
      if (ObjUtil.isNotNull(planListHjxc)&&CollUtil.isNotEmpty(jxctrendVoList)){
         jxctrendVoList.stream().forEach(trendVo->{
            BigDecimal monAmount = planListHjxc.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      ht.put("jxc",jxctrendVoList);
      AnnualPlan planListHYMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556535640576002L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> ymjtrendVoList = contractMapper.zbjtPlanAchieced(2056556535640576002L);
      if (ObjUtil.isNotNull(planListHYMJ)&&CollUtil.isNotEmpty(ymjtrendVoList)){
         ymjtrendVoList.stream().forEach(trendVo->{
            BigDecimal monAmount = planListHYMJ.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      ht.put("ymj",ymjtrendVoList);
      jsonObject.put("ht",ht);
      JSONObject sr = new JSONObject();
      AnnualPlanTotalVo planLisSR = annualPlanMapper.selectPlanYear(curYear,"1");
      List<ZbjtIndicatorTrendVo> trendVoList1 = contractInvoiceMapper.zbjtPlanAchieced(null);
      if (ObjUtil.isNotNull(planLisSR)&&CollUtil.isNotEmpty(trendVoList1)){
         trendVoList1.stream().forEach(trendVo->{
            BigDecimal monAmount = planLisSR.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      sr.put("zb",trendVoList1);
      AnnualPlan planListSRSMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"2")
            .in(AnnualPlan::getCompId,compIds).last("limit 1"));
      List<ZbjtIndicatorTrendVo> smjtrendVoList1 = contractInvoiceMapper.zbjtPlanAchiecedSmj();
      if (ObjUtil.isNotNull(planListSRSMJ)&&CollUtil.isNotEmpty(smjtrendVoList1)){
         smjtrendVoList1.stream().forEach(trendVo->{
            BigDecimal monAmount = planListSRSMJ.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      sr.put("smj",smjtrendVoList1);
      //石工泵收入
      AnnualPlan planListSRSGB = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556196124250113L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> sgbtrendVoList1 = contractInvoiceMapper.zbjtPlanAchieced(2056556196124250113L);
      if (ObjUtil.isNotNull(planListSRSGB)&&CollUtil.isNotEmpty(sgbtrendVoList1)){
         sgbtrendVoList1.stream().forEach(trendVo->{
            BigDecimal monAmount = planListSRSGB.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      sr.put("sgb",sgbtrendVoList1);
      //通方公司收入
      AnnualPlan planListSRTFGS = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556421857497090L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> tfgstrendVoList1 = contractInvoiceMapper.zbjtPlanAchieced(2056556421857497090L);
      if (ObjUtil.isNotNull(planListSRTFGS)&&CollUtil.isNotEmpty(tfgstrendVoList1)){
         tfgstrendVoList1.stream().forEach(trendVo->{
            BigDecimal monAmount = planListSRTFGS.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      sr.put("tfgs",tfgstrendVoList1);
      //机械厂收入
      AnnualPlan planListSRJXC = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556317461270529L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> jxctrendVoList1 = contractInvoiceMapper.zbjtPlanAchieced(2056556317461270529L);
      if (ObjUtil.isNotNull(planListSRJXC)&&CollUtil.isNotEmpty(jxctrendVoList1)){
         jxctrendVoList1.stream().forEach(trendVo->{
            BigDecimal monAmount = planListSRJXC.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      sr.put("jxc",jxctrendVoList1);
      //一煤机收入
      AnnualPlan planListSRYMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556317461270529L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> ymjtrendVoList1 = contractInvoiceMapper.zbjtPlanAchieced(2056556535640576002L);
      if (ObjUtil.isNotNull(planListSRYMJ)&&CollUtil.isNotEmpty(ymjtrendVoList1)){
         ymjtrendVoList1.stream().forEach(trendVo->{
            BigDecimal monAmount = planListSRYMJ.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      sr.put("ymj",ymjtrendVoList1);
      jsonObject.put("sr",sr);
      JSONObject hk = new JSONObject();
      //回款
      AnnualPlanTotalVo planLisHK = annualPlanMapper.selectPlanYear(curYear,"1");
      List<ZbjtIndicatorTrendVo> trendVoList2 = paymentSlipMapper.zbjtPlanAchieced(null);
      if (ObjUtil.isNotNull(planLisHK)&&CollUtil.isNotEmpty(trendVoList2)){
         trendVoList2.stream().forEach(trendVo->{
            BigDecimal monAmount = planLisHK.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      hk.put("zb",trendVoList2);
      //石煤机回款
      AnnualPlan planListHKSMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"2")
            .in(AnnualPlan::getCompId,compIds).last("limit 1"));
      List<ZbjtIndicatorTrendVo> smjtrendVoList2 = paymentSlipMapper.zbjtPlanAchiecedSmj();
      if (ObjUtil.isNotNull(planListHKSMJ)&&CollUtil.isNotEmpty(smjtrendVoList2)){
         smjtrendVoList2.stream().forEach(trendVo->{
            BigDecimal monAmount = planListHKSMJ.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      hk.put("smj",smjtrendVoList2);
      //石工泵回款
      AnnualPlan planListHKSGB = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556196124250113L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> sgbtrendVoList2 = paymentSlipMapper.zbjtPlanAchieced(2056556196124250113L);
      if (ObjUtil.isNotNull(planListHKSGB)&&CollUtil.isNotEmpty(sgbtrendVoList2)){
         sgbtrendVoList2.stream().forEach(trendVo->{
            BigDecimal monAmount = planListHKSGB.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      hk.put("sgb",sgbtrendVoList2);
      //tfgs回款
      AnnualPlan planListHKTFGS = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556421857497090L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> tfgstrendVoList2 = paymentSlipMapper.zbjtPlanAchieced(2056556421857497090L);
      if (ObjUtil.isNotNull(planListHKTFGS)&&CollUtil.isNotEmpty(tfgstrendVoList2)){
         tfgstrendVoList2.stream().forEach(trendVo->{
            BigDecimal monAmount = planListHKTFGS.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      hk.put("tfgs",tfgstrendVoList2);
      //机械厂回款
      AnnualPlan planListHKJXC = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556317461270529L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> jxctrendVoList2 = paymentSlipMapper.zbjtPlanAchieced(2056556317461270529L);
      if (ObjUtil.isNotNull(planListHKJXC)&&CollUtil.isNotEmpty(jxctrendVoList2)){
         jxctrendVoList2.stream().forEach(trendVo->{
            BigDecimal monAmount = planListHKJXC.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      hk.put("jxc",jxctrendVoList2);
      //一煤机回款
      AnnualPlan planListHKYMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
            .eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
            .eq(AnnualPlan::getCompId,2056556535640576002L).last("limit 1"));
      List<ZbjtIndicatorTrendVo> ymjtrendVoList2 = paymentSlipMapper.zbjtPlanAchieced(2056556535640576002L);
      if (ObjUtil.isNotNull(planListHKYMJ)&&CollUtil.isNotEmpty(ymjtrendVoList2)){
         ymjtrendVoList2.stream().forEach(trendVo->{
            BigDecimal monAmount = planListHKYMJ.getMonthAmount(trendVo.getYearMon());
            if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
               trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
            }
         });
      }
      hk.put("ymj",ymjtrendVoList2);
      jsonObject.put("hk",hk);
      return R.ok(jsonObject);
   }
   @Override
   public R zbjtReceiveScale() {
      JSONObject hk = new JSONObject();
      //回款
      List<ZbjtIndicatorTrendVo> trendVoList = paymentReceiveMapper.zbjtReceiveScale(null);
      hk.put("zb",trendVoList);
      //石煤机回款
      List<Long> compIds = new ArrayList<>();
      compIds.add(2089995177814495234L);
      compIds.add(2089996921978040321L);
      compIds.add(2089997578009128962L);
      compIds.add(2101966257365045249L);
      List<ZbjtIndicatorTrendVo> trendVoListSMJ = paymentReceiveMapper.zbjtReceiveScaleSMJ();
      hk.put("smj",trendVoListSMJ);
      //石工泵回款
      List<ZbjtIndicatorTrendVo> trendVoListSGB = paymentReceiveMapper.zbjtReceiveScale(2056556196124250113L);
      hk.put("sgb",trendVoListSGB);
      //tfgs
      List<ZbjtIndicatorTrendVo> trendVoListTFGS = paymentReceiveMapper.zbjtReceiveScale(2056556421857497090L);
      hk.put("tfgs",trendVoListTFGS);
      //机械厂回款
      List<ZbjtIndicatorTrendVo> trendVoListJXC = paymentReceiveMapper.zbjtReceiveScale(2056556317461270529L);
      hk.put("jxc",trendVoListJXC);
      //一煤机回款
      List<ZbjtIndicatorTrendVo> trendVoListYMJ = paymentReceiveMapper.zbjtReceiveScale(2056556535640576002L);
      hk.put("ymj",trendVoListYMJ);
      return R.ok(hk);
   }
}