platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ZBJTStatisticServiceImpl.java
@@ -7,10 +7,7 @@
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.by4cloud.platformx.business.dto.ZBJTStatisticDTO;
import com.by4cloud.platformx.business.entity.AnnualPlan;
import com.by4cloud.platformx.business.entity.AnnualPlanKey;
import com.by4cloud.platformx.business.entity.AnnualTarget;
import com.by4cloud.platformx.business.entity.BipDict;
import com.by4cloud.platformx.business.entity.*;
import com.by4cloud.platformx.business.mapper.*;
import com.by4cloud.platformx.business.service.ZBJTStatisticService;
import com.by4cloud.platformx.business.vo.*;
@@ -42,33 +39,46 @@
   private final BipDictMapper bipDictMapper;
   private final PaymentReceiveMapper paymentReceiveMapper;
   private final HistoryOverdueMapper historyOverdueMapper;
   private final ZbStatisticXszbMapper zbStatisticXszbMapper;
   private final ZbStatisticCpbkMapper zbStatisticCpbkMapper;
   private final ZbStatisticZdgzMapper zbStatisticZdgzMapper;
   private final ZbStatisticZxywMapper zbStatisticZxywMapper;
   private final ZbStatisticCpXssrMapper zbStatisticCpXssrMapper;
   private final ZbStatisticCpXzhtMapper zbStatisticCpXzhtMapper;
   @Override
   public R zyxszbwcqk(ZBJTStatisticDTO queryDTO) {
      if (StrUtil.isBlank(queryDTO.getYearMonth())){
         return R.failed("查询年月不能为空");
      }
      List<ZbStatisticXszb> xszbList = zbStatisticXszbMapper.selectList(Wrappers.<ZbStatisticXszb>lambdaQuery()
            .eq(ZbStatisticXszb::getStatYm,queryDTO.getYearMonth()));
      if (CollUtil.isNotEmpty(xszbList)){
         List<ZyxszbwcqkVo> list = BeanUtil.copyToList(xszbList,ZyxszbwcqkVo.class);
         return R.ok(list);
      }
      List<ZyxszbwcqkVo> list = new ArrayList<>();
      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date monstartLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00"),-1);
      Date monendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
      Date yearstart = DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00");
      Date yearend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date yearstartLastYear =  DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00"),-1);
      Date yearendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
      HomeZbjtVo hk = paymentSlipMapper.homeZbjtYearAndMon(monstart,monend,yearstart,yearend,
            monstartLastYear,monendLastYear,yearstartLastYear,yearendLastYear);
      list = handlezBJTVo("货款回收",list,hk,queryDTO.getYearMonth().substring(0,4), queryDTO.getYearMonth().substring(5), "3");
      HomeZbjtVo kp = contractInvoiceMapper.homeZbjtYearAndMon(monstart,monend,yearstart,yearend);
      list = handlezBJTVo("销售收入",list,kp,queryDTO.getYearMonth().substring(0,4), queryDTO.getYearMonth().substring(5), "2");
      HomeZbjtVo htqd = contractMapper.homeZbjtYearAndMon(monstart,monend,yearstart,yearend);
      list = handlezBJTVo("新增合同",list,htqd,queryDTO.getYearMonth().substring(0,4), queryDTO.getYearMonth().substring(5), "1");
//      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
//      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
//      Date monstartLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00"),-1);
//      Date monendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
//      Date yearstart = DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00");
//      Date yearend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
//      Date yearstartLastYear =  DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00"),-1);
//      Date yearendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
//
//      HomeZbjtVo hk = paymentSlipMapper.homeZbjtYearAndMon(monstart,monend,yearstart,yearend,
//            monstartLastYear,monendLastYear,yearstartLastYear,yearendLastYear);
//      list = handlezBJTVo("货款回收",list,hk,queryDTO.getYearMonth().substring(0,4), queryDTO.getYearMonth().substring(5), "3");
//
//      HomeZbjtVo kp = contractInvoiceMapper.homeZbjtYearAndMon(monstart,monend,yearstart,yearend);
//
//      list = handlezBJTVo("销售收入",list,kp,queryDTO.getYearMonth().substring(0,4), queryDTO.getYearMonth().substring(5), "2");
//
//      HomeZbjtVo htqd = contractMapper.homeZbjtYearAndMon(monstart,monend,yearstart,yearend);
//
//      list = handlezBJTVo("新增合同",list,htqd,queryDTO.getYearMonth().substring(0,4), queryDTO.getYearMonth().substring(5), "1");
      return R.ok(list);
   }
@@ -359,7 +369,7 @@
      if (StrUtil.isBlank(queryDTO.getYearMonth())){
         return R.failed("查询年月不能为空");
      }
      List<GcpbkwcqkVo> list = new ArrayList<>();
      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date monstartLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00"),-1);
@@ -368,169 +378,176 @@
      Date yearend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date yearstartLastYear =  DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00"),-1);
      Date yearendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
      //新增合同
      List<GcpbkwcqkItemVo> itemVoListMon = contractSubjectMatterMapper.gcpbkwcqk(monstart,monend);
      List<GcpbkwcqkItemVo> itemVoListMonLastYear = contractSubjectMatterMapper.gcpbkwcqk(monstartLastYear,monendLastYear);
      if (CollUtil.isNotEmpty(itemVoListMon)){
         itemVoListMon.stream().forEach(item->{
            GcpbkwcqkVo vo = new GcpbkwcqkVo();
            vo.setXm("新增合同");
            vo.setBkmc(item.getBkmc());
            vo.setDywc(item.getWc());
            if (CollUtil.isNotEmpty(itemVoListMonLastYear)){
               itemVoListMonLastYear.stream().forEach(item1->{
                  if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                     BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                     vo.setYtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
      List<ZbStatisticCpbk> xszbList = zbStatisticCpbkMapper.selectList(Wrappers.<ZbStatisticCpbk>lambdaQuery()
            .eq(ZbStatisticCpbk::getStatYm,queryDTO.getYearMonth()));
      if (CollUtil.isNotEmpty(xszbList)){
         List<GcpbkwcqkVo> list = BeanUtil.copyToList(xszbList,GcpbkwcqkVo.class);
         return R.ok(list);
                  }
               });
            }
            list.add(vo);
         });
      }
      List<GcpbkwcqkItemVo> itemVoListYear = contractSubjectMatterMapper.gcpbkwcqk(yearstart,yearend);
      List<GcpbkwcqkItemVo> itemVoListYearLastYear = contractSubjectMatterMapper.gcpbkwcqk(yearstartLastYear,yearendLastYear);
      if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYear)){
         BigDecimal ljzh = itemVoListYear.stream().map(item->item.getWc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
         for (GcpbkwcqkVo vo:list
             ) {
            for (GcpbkwcqkItemVo itemVo:itemVoListYear
            ) {
               if (StrUtil.equals(vo.getBkmc(),itemVo.getBkmc())&&StrUtil.equals(vo.getXm(),"新增合同")){
                  vo.setLjwc(itemVo.getWc());
                  if (ljzh.compareTo(new BigDecimal("0"))>0){
                     BigDecimal zb = vo.getLjwc().divide(ljzh,10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                     vo.setBnzb(zb.setScale(2,RoundingMode.HALF_UP)+"%");
                  }
               }
               if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
                  BigDecimal qnljzh = itemVoListYearLastYear.stream().map(item->item.getWc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
                  itemVoListYearLastYear.stream().forEach(item1->{
                     if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&StrUtil.equals(vo.getXm(),"新增合同")&&
                           item1.getWc().compareTo(new BigDecimal("0"))>0){
                        BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                        vo.setNtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
                     }
                     if (qnljzh.compareTo(new BigDecimal("0"))>0){
                        BigDecimal qnzb = item1.getWc().divide(qnljzh,10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                        if (StrUtil.isNotBlank(vo.getBnzb())){
                           BigDecimal bnzb = new BigDecimal(vo.getBnzb().substring(0,vo.getBnzb().length()-1));
                           vo.setZtqb(bnzb.subtract(qnzb)+"%");
                        }
                     }
                  });
               }
            }
         }
      }
      //销售收入
      List<GcpbkwcqkItemVo> itemVoSRListMon = contractOutBoundMapper.gcpbkwcqk(monstart,monend);
      List<GcpbkwcqkItemVo> itemVoListSRMonLastYear = contractOutBoundMapper.gcpbkwcqk(monstartLastYear,monendLastYear);
      if (CollUtil.isNotEmpty(itemVoSRListMon)){
         itemVoSRListMon.stream().forEach(item->{
            GcpbkwcqkVo vo = new GcpbkwcqkVo();
            vo.setXm("销售收入");
            vo.setBkmc(item.getBkmc());
            vo.setDywc(item.getWc());
            if (CollUtil.isNotEmpty(itemVoListSRMonLastYear)){
               itemVoListSRMonLastYear.stream().forEach(item1->{
                  if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                     BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                     vo.setYtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
                  }
               });
            }
            list.add(vo);
         });
      }
      List<GcpbkwcqkItemVo> itemVoListSRYear = contractOutBoundMapper.gcpbkwcqk(yearstart,yearend);
      List<GcpbkwcqkItemVo> itemVoListSRYearLastYear = contractOutBoundMapper.gcpbkwcqk(yearstartLastYear,yearendLastYear);
      if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListSRYear)){
         BigDecimal ljzh = itemVoListSRYear.stream().map(item->item.getWc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
         for (GcpbkwcqkVo vo:list
         ) {
            for (GcpbkwcqkItemVo itemVo:itemVoListSRYear
            ) {
               if (StrUtil.equals(vo.getBkmc(),itemVo.getBkmc())&&StrUtil.equals(vo.getXm(),"销售收入")){
                  vo.setLjwc(itemVo.getWc());
                  if (ljzh.compareTo(new BigDecimal("0"))>0){
                     BigDecimal zb = vo.getLjwc().divide(ljzh,10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                     vo.setBnzb(zb.setScale(2,RoundingMode.HALF_UP)+"%");
                  }
               }
               if (CollUtil.isNotEmpty(itemVoListSRYearLastYear)){
                  BigDecimal qnljzh = itemVoListSRYearLastYear.stream().map(item->item.getWc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
                  itemVoListSRYearLastYear.stream().forEach(item1->{
                     if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&StrUtil.equals(vo.getXm(),"销售收入")&&
                           item1.getWc().compareTo(new BigDecimal("0"))>0){
                        BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                        vo.setNtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
                     }
                     if (qnljzh.compareTo(new BigDecimal("0"))>0){
                        BigDecimal qnzb = item1.getWc().divide(qnljzh,10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                        if (StrUtil.isNotBlank(vo.getBnzb())){
                           BigDecimal bnzb = new BigDecimal(vo.getBnzb().substring(0,vo.getBnzb().length()-1));
                           vo.setZtqb(bnzb.subtract(qnzb)+"%");
                        }
                     }
                  });
               }
            }
         }
      }
      //货款回收
      List<GcpbkwcqkItemVo> itemVoListSKMon = contractSubjectMatterMapper.gcpbkwcqkBySK(monstart,monend);
      List<GcpbkwcqkItemVo> itemVoListSKMonLastYear = contractSubjectMatterMapper.gcpbkwcqkBySK(monstartLastYear,monendLastYear);
      if (CollUtil.isNotEmpty(itemVoListSKMon)){
         itemVoListSKMon.stream().forEach(item->{
            GcpbkwcqkVo vo = new GcpbkwcqkVo();
            vo.setXm("货款回收");
            vo.setBkmc(item.getBkmc());
            vo.setDywc(item.getWc());
            if (CollUtil.isNotEmpty(itemVoListSKMonLastYear)){
               itemVoListSKMonLastYear.stream().forEach(item1->{
                  if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                     BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                     vo.setYtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
                  }
               });
            }
            list.add(vo);
         });
      }
      List<GcpbkwcqkItemVo> itemVoListSKYear = contractSubjectMatterMapper.gcpbkwcqkBySK(yearstart,yearend);
      List<GcpbkwcqkItemVo> itemVoListSKYearLastYear = contractSubjectMatterMapper.gcpbkwcqkBySK(yearstartLastYear,yearendLastYear);
      if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListSKYear)){
         for (GcpbkwcqkVo vo:list
         ) {
            for (GcpbkwcqkItemVo itemVo:itemVoListSKYear
            ) {
               if (StrUtil.equals(vo.getBkmc(),itemVo.getBkmc())&&StrUtil.equals(vo.getXm(),"货款回收")){
                  vo.setLjwc(itemVo.getWc());
               }
               if (CollUtil.isNotEmpty(itemVoListSKYearLastYear)){
                  BigDecimal qnljzh = itemVoListSKYearLastYear.stream().map(item->item.getWc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
                  itemVoListSKYearLastYear.stream().forEach(item1->{
                     if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&StrUtil.equals(vo.getXm(),"货款回收")&&
                           item1.getWc().compareTo(new BigDecimal("0"))>0){
                        BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                        vo.setNtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
                     }
                     if (qnljzh.compareTo(new BigDecimal("0"))>0){
                        BigDecimal qnzb = item1.getWc().divide(qnljzh,10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                        if (StrUtil.isNotBlank(vo.getBnzb())){
                           BigDecimal bnzb = new BigDecimal(vo.getBnzb().substring(0,vo.getBnzb().length()-1));
                           vo.setZtqb(bnzb.subtract(qnzb)+"%");
                        }
                     }
                  });
               }
            }
         }
      }
      List<GcpbkwcqkVo> list = new ArrayList<>();
//      //新增合同
//      List<GcpbkwcqkItemVo> itemVoListMon = contractSubjectMatterMapper.gcpbkwcqk(monstart,monend);
//      List<GcpbkwcqkItemVo> itemVoListMonLastYear = contractSubjectMatterMapper.gcpbkwcqk(monstartLastYear,monendLastYear);
//      if (CollUtil.isNotEmpty(itemVoListMon)){
//         itemVoListMon.stream().forEach(item->{
//            GcpbkwcqkVo vo = new GcpbkwcqkVo();
//            vo.setXm("新增合同");
//            vo.setBkmc(item.getBkmc());
//            vo.setDywc(item.getWc());
//            if (CollUtil.isNotEmpty(itemVoListMonLastYear)){
//               itemVoListMonLastYear.stream().forEach(item1->{
//                  if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                     BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                     vo.setYtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
//                  }
//               });
//            }
//            list.add(vo);
//         });
//      }
//      List<GcpbkwcqkItemVo> itemVoListYear = contractSubjectMatterMapper.gcpbkwcqk(yearstart,yearend);
//      List<GcpbkwcqkItemVo> itemVoListYearLastYear = contractSubjectMatterMapper.gcpbkwcqk(yearstartLastYear,yearendLastYear);
//      if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYear)){
//         BigDecimal ljzh = itemVoListYear.stream().map(item->item.getWc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
//         for (GcpbkwcqkVo vo:list
//             ) {
//            for (GcpbkwcqkItemVo itemVo:itemVoListYear
//            ) {
//               if (StrUtil.equals(vo.getBkmc(),itemVo.getBkmc())&&StrUtil.equals(vo.getXm(),"新增合同")){
//                  vo.setLjwc(itemVo.getWc());
//                  if (ljzh.compareTo(new BigDecimal("0"))>0){
//                     BigDecimal zb = vo.getLjwc().divide(ljzh,10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                     vo.setBnzb(zb.setScale(2,RoundingMode.HALF_UP)+"%");
//                  }
//
//               }
//               if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
//                  BigDecimal qnljzh = itemVoListYearLastYear.stream().map(item->item.getWc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
//
//                  itemVoListYearLastYear.stream().forEach(item1->{
//                     if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&StrUtil.equals(vo.getXm(),"新增合同")&&
//                           item1.getWc().compareTo(new BigDecimal("0"))>0){
//                        BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                        vo.setNtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
//                     }
//                     if (qnljzh.compareTo(new BigDecimal("0"))>0){
//                        BigDecimal qnzb = item1.getWc().divide(qnljzh,10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                        if (StrUtil.isNotBlank(vo.getBnzb())){
//                           BigDecimal bnzb = new BigDecimal(vo.getBnzb().substring(0,vo.getBnzb().length()-1));
//                           vo.setZtqb(bnzb.subtract(qnzb)+"%");
//                        }
//                     }
//                  });
//               }
//            }
//         }
//      }
//      //销售收入
//      List<GcpbkwcqkItemVo> itemVoSRListMon = contractOutBoundMapper.gcpbkwcqk(monstart,monend);
//      List<GcpbkwcqkItemVo> itemVoListSRMonLastYear = contractOutBoundMapper.gcpbkwcqk(monstartLastYear,monendLastYear);
//      if (CollUtil.isNotEmpty(itemVoSRListMon)){
//         itemVoSRListMon.stream().forEach(item->{
//            GcpbkwcqkVo vo = new GcpbkwcqkVo();
//            vo.setXm("销售收入");
//            vo.setBkmc(item.getBkmc());
//            vo.setDywc(item.getWc());
//            if (CollUtil.isNotEmpty(itemVoListSRMonLastYear)){
//               itemVoListSRMonLastYear.stream().forEach(item1->{
//                  if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                     BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                     vo.setYtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
//                  }
//               });
//            }
//            list.add(vo);
//         });
//      }
//      List<GcpbkwcqkItemVo> itemVoListSRYear = contractOutBoundMapper.gcpbkwcqk(yearstart,yearend);
//      List<GcpbkwcqkItemVo> itemVoListSRYearLastYear = contractOutBoundMapper.gcpbkwcqk(yearstartLastYear,yearendLastYear);
//      if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListSRYear)){
//         BigDecimal ljzh = itemVoListSRYear.stream().map(item->item.getWc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
//         for (GcpbkwcqkVo vo:list
//         ) {
//            for (GcpbkwcqkItemVo itemVo:itemVoListSRYear
//            ) {
//               if (StrUtil.equals(vo.getBkmc(),itemVo.getBkmc())&&StrUtil.equals(vo.getXm(),"销售收入")){
//                  vo.setLjwc(itemVo.getWc());
//                  if (ljzh.compareTo(new BigDecimal("0"))>0){
//                     BigDecimal zb = vo.getLjwc().divide(ljzh,10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                     vo.setBnzb(zb.setScale(2,RoundingMode.HALF_UP)+"%");
//                  }
//               }
//               if (CollUtil.isNotEmpty(itemVoListSRYearLastYear)){
//                  BigDecimal qnljzh = itemVoListSRYearLastYear.stream().map(item->item.getWc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
//
//                  itemVoListSRYearLastYear.stream().forEach(item1->{
//                     if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&StrUtil.equals(vo.getXm(),"销售收入")&&
//                           item1.getWc().compareTo(new BigDecimal("0"))>0){
//                        BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                        vo.setNtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
//                     }
//                     if (qnljzh.compareTo(new BigDecimal("0"))>0){
//                        BigDecimal qnzb = item1.getWc().divide(qnljzh,10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                        if (StrUtil.isNotBlank(vo.getBnzb())){
//                           BigDecimal bnzb = new BigDecimal(vo.getBnzb().substring(0,vo.getBnzb().length()-1));
//                           vo.setZtqb(bnzb.subtract(qnzb)+"%");
//                        }
//                     }
//                  });
//               }
//            }
//         }
//      }
//      //货款回收
//      List<GcpbkwcqkItemVo> itemVoListSKMon = contractSubjectMatterMapper.gcpbkwcqkBySK(monstart,monend);
//      List<GcpbkwcqkItemVo> itemVoListSKMonLastYear = contractSubjectMatterMapper.gcpbkwcqkBySK(monstartLastYear,monendLastYear);
//      if (CollUtil.isNotEmpty(itemVoListSKMon)){
//         itemVoListSKMon.stream().forEach(item->{
//            GcpbkwcqkVo vo = new GcpbkwcqkVo();
//            vo.setXm("货款回收");
//            vo.setBkmc(item.getBkmc());
//            vo.setDywc(item.getWc());
//            if (CollUtil.isNotEmpty(itemVoListSKMonLastYear)){
//               itemVoListSKMonLastYear.stream().forEach(item1->{
//                  if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                     BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                     vo.setYtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
//                  }
//               });
//            }
//            list.add(vo);
//         });
//      }
//      List<GcpbkwcqkItemVo> itemVoListSKYear = contractSubjectMatterMapper.gcpbkwcqkBySK(yearstart,yearend);
//      List<GcpbkwcqkItemVo> itemVoListSKYearLastYear = contractSubjectMatterMapper.gcpbkwcqkBySK(yearstartLastYear,yearendLastYear);
//      if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListSKYear)){
//         for (GcpbkwcqkVo vo:list
//         ) {
//            for (GcpbkwcqkItemVo itemVo:itemVoListSKYear
//            ) {
//               if (StrUtil.equals(vo.getBkmc(),itemVo.getBkmc())&&StrUtil.equals(vo.getXm(),"货款回收")){
//                  vo.setLjwc(itemVo.getWc());
//               }
//               if (CollUtil.isNotEmpty(itemVoListSKYearLastYear)){
//                  BigDecimal qnljzh = itemVoListSKYearLastYear.stream().map(item->item.getWc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
//                  itemVoListSKYearLastYear.stream().forEach(item1->{
//                     if (StrUtil.equals(vo.getBkmc(),item1.getBkmc())&&StrUtil.equals(vo.getXm(),"货款回收")&&
//                           item1.getWc().compareTo(new BigDecimal("0"))>0){
//                        BigDecimal percent = vo.getDywc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                        vo.setNtqb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
//                     }
//                     if (qnljzh.compareTo(new BigDecimal("0"))>0){
//                        BigDecimal qnzb = item1.getWc().divide(qnljzh,10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                        if (StrUtil.isNotBlank(vo.getBnzb())){
//                           BigDecimal bnzb = new BigDecimal(vo.getBnzb().substring(0,vo.getBnzb().length()-1));
//                           vo.setZtqb(bnzb.subtract(qnzb)+"%");
//                        }
//                     }
//                  });
//               }
//            }
//         }
//      }
      return R.ok(list);
   }
@@ -539,76 +556,82 @@
      if (StrUtil.isBlank(queryDTO.getYearMonth())){
         return R.failed("查询年月不能为空");
      }
      List<ZbStatisticZdgz> xszbList = zbStatisticZdgzMapper.selectList(Wrappers.<ZbStatisticZdgz>lambdaQuery()
            .eq(ZbStatisticZdgz::getStatYm,queryDTO.getYearMonth()));
      if (CollUtil.isNotEmpty(xszbList)){
         List<SckfzdgzwcqkVo> list = BeanUtil.copyToList(xszbList,SckfzdgzwcqkVo.class);
         return R.ok(list);
      }
      List<SckfzdgzwcqkVo> list = new ArrayList<>();
      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date monstartLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00"),-1);
      Date monendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
      Date yearstart = DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00");
      Date yearend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date yearstartLastYear =  DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00"),-1);
      Date yearendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
      //新增合同
      List<GcpbkwcqkItemVo> itemVoListMon = contractSubjectMatterMapper.sckfzdgzwcqk(monstart,monend);
      if (CollUtil.isNotEmpty(itemVoListMon)){
         itemVoListMon.stream().forEach(item->{
            SckfzdgzwcqkVo vo = new SckfzdgzwcqkVo();
            vo.setDw(item.getDw());
            vo.setXm(item.getXm());
            vo.setDywc(item.getWc());
            Long compId = null;
            if (StrUtil.equals(item.getDw(),"石煤机")){
               compId = 2089995177814495234L;
            }
            if (StrUtil.equals(item.getDw(),"石工泵")){
               compId = 2056556196124250113L;
            }
            if (StrUtil.equals(item.getDw(),"通方厂")){
               compId = 2056556317461270529L;
            }
            if (StrUtil.equals(item.getDw(),"邢台厂")){
               compId = 2056556421857497090L;
            }
            AnnualPlanKey plan = annualPlanKeyMapper.selectOne(Wrappers.<AnnualPlanKey>lambdaQuery()
                  .eq(AnnualPlanKey::getPlanYear, queryDTO.getYearMonth().substring(0,4)).eq(AnnualPlanKey::getPlanType, item.getCode())
                  .eq(AnnualPlanKey::getCompId, compId).last("limit 1"));
            if (ObjUtil.isNotNull(plan)){
               vo.setDyjh(plan.getMonthAmount(queryDTO.getYearMonth().substring(5)));
               vo.setLjjh(plan.getToMonTotalAmount(queryDTO.getYearMonth().substring(5)));
               if (vo.getDyjh().compareTo(new BigDecimal("0"))>0){
                  vo.setYwcl(vo.getDywc().divide(vo.getDyjh(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"))
                        .setScale(2,RoundingMode.HALF_UP)+"%");
               }
            }
            list.add(vo);
         });
      }
      List<GcpbkwcqkItemVo> itemVoListYear = contractSubjectMatterMapper.sckfzdgzwcqk(yearstart,yearend);
      List<GcpbkwcqkItemVo> itemVoListYearLastYear = contractSubjectMatterMapper.sckfzdgzwcqk(yearstartLastYear,yearendLastYear);
      if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYear)){
         for (SckfzdgzwcqkVo vo:list
         ) {
            for (GcpbkwcqkItemVo itemVo:itemVoListYear
            ) {
               if (StrUtil.equals(vo.getDw(),itemVo.getDw())&&StrUtil.equals(vo.getXm(),itemVo.getXm())){
                  vo.setLjwc(itemVo.getWc());
                  if (ObjUtil.isNotNull(vo.getLjjh())&&vo.getLjjh().compareTo(new BigDecimal("0"))>0){
                     vo.setLjwcl(vo.getLjwc().divide(vo.getLjjh(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"))
                           .setScale(2,RoundingMode.HALF_UP)+"%");
                  }
               }
               if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
                  itemVoListYearLastYear.stream().forEach(item1->{
                     if (StrUtil.equals(vo.getDw(),item1.getDw())&&StrUtil.equals(vo.getXm(),itemVo.getXm())&&
                           item1.getWc().compareTo(new BigDecimal("0"))>0){
                        BigDecimal percent = vo.getLjwc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
                        vo.setLjtb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
                     }
                  });
               }
            }
         }
      }
//      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
//      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
//      Date monstartLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00"),-1);
//      Date monendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
//      Date yearstart = DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00");
//      Date yearend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
//      Date yearstartLastYear =  DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00"),-1);
//      Date yearendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
//      //新增合同
//      List<GcpbkwcqkItemVo> itemVoListMon = contractSubjectMatterMapper.sckfzdgzwcqk(monstart,monend);
//      if (CollUtil.isNotEmpty(itemVoListMon)){
//         itemVoListMon.stream().forEach(item->{
//            SckfzdgzwcqkVo vo = new SckfzdgzwcqkVo();
//            vo.setDw(item.getDw());
//            vo.setXm(item.getXm());
//            vo.setDywc(item.getWc());
//            Long compId = null;
//            if (StrUtil.equals(item.getDw(),"石煤机")){
//               compId = 2089995177814495234L;
//            }
//            if (StrUtil.equals(item.getDw(),"石工泵")){
//               compId = 2056556196124250113L;
//            }
//            if (StrUtil.equals(item.getDw(),"通方厂")){
//               compId = 2056556317461270529L;
//            }
//            if (StrUtil.equals(item.getDw(),"邢台厂")){
//               compId = 2056556421857497090L;
//            }
//            AnnualPlanKey plan = annualPlanKeyMapper.selectOne(Wrappers.<AnnualPlanKey>lambdaQuery()
//                  .eq(AnnualPlanKey::getPlanYear, queryDTO.getYearMonth().substring(0,4)).eq(AnnualPlanKey::getPlanType, item.getCode())
//                  .eq(AnnualPlanKey::getCompId, compId).last("limit 1"));
//            if (ObjUtil.isNotNull(plan)){
//               vo.setDyjh(plan.getMonthAmount(queryDTO.getYearMonth().substring(5)));
//               vo.setLjjh(plan.getToMonTotalAmount(queryDTO.getYearMonth().substring(5)));
//               if (vo.getDyjh().compareTo(new BigDecimal("0"))>0){
//                  vo.setYwcl(vo.getDywc().divide(vo.getDyjh(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"))
//                        .setScale(2,RoundingMode.HALF_UP)+"%");
//               }
//            }
//            list.add(vo);
//         });
//      }
//      List<GcpbkwcqkItemVo> itemVoListYear = contractSubjectMatterMapper.sckfzdgzwcqk(yearstart,yearend);
//      List<GcpbkwcqkItemVo> itemVoListYearLastYear = contractSubjectMatterMapper.sckfzdgzwcqk(yearstartLastYear,yearendLastYear);
//      if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYear)){
//         for (SckfzdgzwcqkVo vo:list
//         ) {
//            for (GcpbkwcqkItemVo itemVo:itemVoListYear
//            ) {
//               if (StrUtil.equals(vo.getDw(),itemVo.getDw())&&StrUtil.equals(vo.getXm(),itemVo.getXm())){
//                  vo.setLjwc(itemVo.getWc());
//                  if (ObjUtil.isNotNull(vo.getLjjh())&&vo.getLjjh().compareTo(new BigDecimal("0"))>0){
//                     vo.setLjwcl(vo.getLjwc().divide(vo.getLjjh(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"))
//                           .setScale(2,RoundingMode.HALF_UP)+"%");
//                  }
//               }
//               if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
//                  itemVoListYearLastYear.stream().forEach(item1->{
//                     if (StrUtil.equals(vo.getDw(),item1.getDw())&&StrUtil.equals(vo.getXm(),itemVo.getXm())&&
//                           item1.getWc().compareTo(new BigDecimal("0"))>0){
//                        BigDecimal percent = vo.getLjwc().subtract(item1.getWc()).divide(item1.getWc(),10,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
//                        vo.setLjtb(percent.setScale(2,RoundingMode.HALF_UP)+"%");
//                     }
//                  });
//               }
//            }
//         }
//      }
      return R.ok(list);
   }
@@ -617,512 +640,518 @@
      if (StrUtil.isBlank(queryDTO.getYearMonth())){
         return R.failed("查询年月不能为空");
      }
      List<ZbStatisticZxyw> xszbList = zbStatisticZxywMapper.selectList(Wrappers.<ZbStatisticZxyw>lambdaQuery()
            .eq(ZbStatisticZxyw::getStatYm,queryDTO.getYearMonth()));
      if (CollUtil.isNotEmpty(xszbList)){
         List<PjdxcksxywwcqkVo> list = BeanUtil.copyToList(xszbList,PjdxcksxywwcqkVo.class);
         return R.ok(list);
      }
      List<PjdxcksxywwcqkVo> list = new ArrayList<>();
      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date monstartLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00"),-1);
      Date monendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
      Date yearstart = DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00");
      Date yearend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date yearstartLastYear =  DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00"),-1);
      Date yearendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
      if (true){
         //配件开票
         List<GcpbkwcqkItemVo> itemVoListMon = contractInvoiceMapper.pjsxywwcqk("1",monstart,monend);
         List<GcpbkwcqkItemVo> itemVoListMonrLastYear = contractInvoiceMapper.pjsxywwcqk("1",monstartLastYear,monstartLastYear);
         if (CollUtil.isNotEmpty(itemVoListMon)){
            itemVoListMon.stream().forEach(item->{
               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
               vo.setYw(item.getYw());
               vo.setLb(item.getLb());
               vo.setDw(item.getDw());
               vo.setDywc(item.getWc());
               if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
                  itemVoListMon.stream().forEach(item1-> {
                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                        vo.setQnwc(item1.getWc());
                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
                        }
                     }
                  });
               }
               list.add(vo);
            });
            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
            vo.setYw(itemVoListMon.get(0).getYw());
            vo.setLb(itemVoListMon.get(0).getLb());
            vo.setDw("集团");
            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
            if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
               vo.setQnwc(itemVoListMonrLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
               }
            }
            list.add(vo);
         }
         List<GcpbkwcqkItemVo> itemVoListYear = contractInvoiceMapper.pjsxywwcqk("1",yearstart,yearend);
         List<GcpbkwcqkItemVo> itemVoListYearLastYear = contractInvoiceMapper.pjsxywwcqk("1",yearstartLastYear,yearendLastYear);
         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYear)){
            for (PjdxcksxywwcqkVo vo:list
            ) {
               for (GcpbkwcqkItemVo itemVo:itemVoListYear
               ) {
                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
                     vo.setLjwc(itemVo.getWc());
                  }
                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
                     itemVoListYearLastYear.stream().forEach(item1->{
                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                           vo.setQntq(item1.getWc());
                           vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
                           if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
                              vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
                           }
                        }
                     });
                  }
               }
               if (StrUtil.equals(vo.getYw(),"配件")&&StrUtil.equals(vo.getLb(),"销售收入")&&
                     StrUtil.equals(vo.getDw(),"集团")){
                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
                     vo.setQntq(itemVoListYearLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
                     }
                  }
               }
            }
         }
         //配件合同
         List<GcpbkwcqkItemVo> itemVoListMonHT = contractMapper.pjsxywwcqkHT("1",monstart,monend);
         List<GcpbkwcqkItemVo> itemVoListMonrHTLastYear = contractMapper.pjsxywwcqkHT("1",monstartLastYear,monstartLastYear);
         if (CollUtil.isNotEmpty(itemVoListMonHT)){
            itemVoListMonHT.stream().forEach(item->{
               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
               vo.setYw(item.getYw());
               vo.setLb(item.getLb());
               vo.setDw(item.getDw());
               vo.setDywc(item.getWc());
               if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
                  itemVoListMonrHTLastYear.stream().forEach(item1-> {
                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                        vo.setQnwc(item1.getWc());
                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
                        }
                     }
                  });
               }
               list.add(vo);
            });
            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
            vo.setYw(itemVoListMon.get(0).getYw());
            vo.setLb(itemVoListMon.get(0).getLb());
            vo.setDw("集团");
            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
            if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
               vo.setQnwc(itemVoListMonrHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
               }
            }
            list.add(vo);
         }
         List<GcpbkwcqkItemVo> itemVoListYearHT = contractMapper.pjsxywwcqkHT("1",yearstart,yearend);
         List<GcpbkwcqkItemVo> itemVoListYearHTLastYear = contractMapper.pjsxywwcqkHT("1",yearstartLastYear,yearendLastYear);
         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYearHT)){
            for (PjdxcksxywwcqkVo vo:list
            ) {
               for (GcpbkwcqkItemVo itemVo:itemVoListYearHT
               ) {
                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
                     vo.setLjwc(itemVo.getWc());
                  }
                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
                     itemVoListYearHTLastYear.stream().forEach(item1->{
                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                           vo.setQntq(item1.getWc());
                           vo.setLjtb(vo.getLjwc().subtract(item1.getWc()));
                           if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
                              vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
                           }
                        }
                     });
                  }
               }
               if (StrUtil.equals(vo.getYw(),"配件")&&StrUtil.equals(vo.getLb(),"新增合同")&&
                     StrUtil.equals(vo.getDw(),"集团")){
                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
                     vo.setQntq(itemVoListYearHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
                     }
                  }
               }
            }
         }
      }
      if (true){
         //大修开票
         List<GcpbkwcqkItemVo> itemVoListMon = contractInvoiceMapper.dxsxywwcqk("2",monstart,monend);
         List<GcpbkwcqkItemVo> itemVoListMonrLastYear = contractInvoiceMapper.dxsxywwcqk("2",monstartLastYear,monendLastYear);
         if (CollUtil.isNotEmpty(itemVoListMon)){
            itemVoListMon.stream().forEach(item->{
               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
               vo.setYw(item.getYw());
               vo.setLb(item.getLb());
               vo.setDw(item.getDw());
               vo.setDywc(item.getWc());
               if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
                  itemVoListMon.stream().forEach(item1-> {
                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                        vo.setQnwc(item1.getWc());
                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
                        }
                     }
                  });
               }
               list.add(vo);
            });
            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
            vo.setYw(itemVoListMon.get(0).getYw());
            vo.setLb(itemVoListMon.get(0).getLb());
            vo.setDw("集团");
            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
            if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
               vo.setQnwc(itemVoListMonrLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
               }
            }
            list.add(vo);
         }
         List<GcpbkwcqkItemVo> itemVoListYear = contractInvoiceMapper.dxsxywwcqk("2",yearstart,yearend);
         List<GcpbkwcqkItemVo> itemVoListYearLastYear = contractInvoiceMapper.dxsxywwcqk("2",yearstartLastYear,yearendLastYear);
         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYear)){
            for (PjdxcksxywwcqkVo vo:list
            ) {
               for (GcpbkwcqkItemVo itemVo:itemVoListYear
               ) {
                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
                     vo.setLjwc(itemVo.getWc());
                  }
                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
                     itemVoListYearLastYear.stream().forEach(item1->{
                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                           vo.setQntq(item1.getWc());
                           vo.setLjtb(vo.getLjwc().subtract(item1.getWc()));
                           if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                              vo.setLjtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
                           }
                        }
                     });
                  }
               }
               if (StrUtil.equals(vo.getYw(),"大修")&&StrUtil.equals(vo.getLb(),"销售收入")&&
                     StrUtil.equals(vo.getDw(),"集团")){
                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
                     vo.setQntq(itemVoListYearLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
                     }
                  }
               }
            }
         }
         //大修合同
         List<GcpbkwcqkItemVo> itemVoListMonHT = contractMapper.dxsxywwcqkHT("2",monstart,monend);
         List<GcpbkwcqkItemVo> itemVoListMonrHTLastYear = contractMapper.dxsxywwcqkHT("2",monstartLastYear,monendLastYear);
         if (CollUtil.isNotEmpty(itemVoListMonHT)){
            itemVoListMonHT.stream().forEach(item->{
               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
               vo.setYw(item.getYw());
               vo.setLb(item.getLb());
               vo.setDw(item.getDw());
               vo.setDywc(item.getWc());
               if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
                  itemVoListMonrHTLastYear.stream().forEach(item1-> {
                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                        vo.setQnwc(item1.getWc());
                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
                        }
                     }
                  });
               }
               list.add(vo);
            });
            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
            vo.setYw(itemVoListMon.get(0).getYw());
            vo.setLb(itemVoListMon.get(0).getLb());
            vo.setDw("集团");
            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
            if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
               vo.setQnwc(itemVoListMonrHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
               }
            }
            list.add(vo);
         }
         List<GcpbkwcqkItemVo> itemVoListYearHT = contractMapper.dxsxywwcqkHT("2",yearstart,yearend);
         List<GcpbkwcqkItemVo> itemVoListYearHTLastYear = contractMapper.dxsxywwcqkHT("2",yearstartLastYear,yearendLastYear);
         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYearHT)){
            for (PjdxcksxywwcqkVo vo:list
            ) {
               for (GcpbkwcqkItemVo itemVo:itemVoListYearHT
               ) {
                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
                     vo.setLjwc(itemVo.getWc());
                  }
                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
                     itemVoListYearHTLastYear.stream().forEach(item1->{
                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                           vo.setQntq(item1.getWc());
                           vo.setLjtb(vo.getLjwc().subtract(item1.getWc()));
                           if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                              vo.setLjtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
                           }
                        }
                     });
                  }
               }
               if (StrUtil.equals(vo.getYw(),"大修")&&StrUtil.equals(vo.getLb(),"新增合同")&&
                     StrUtil.equals(vo.getDw(),"集团")){
                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
                     vo.setQntq(itemVoListYearHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
                     }
                  }
               }
            }
         }
      }
      if (true){
         //出口开票
         List<GcpbkwcqkItemVo> itemVoListMon = contractInvoiceMapper.cksxywwcqk("1",monstart,monend);
         List<GcpbkwcqkItemVo> itemVoListMonrLastYear = contractInvoiceMapper.cksxywwcqk("1",monstartLastYear,monendLastYear);
         if (CollUtil.isNotEmpty(itemVoListMon)){
            itemVoListMon.stream().forEach(item->{
               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
               vo.setYw(item.getYw());
               vo.setLb(item.getLb());
               vo.setDw(item.getDw());
               vo.setDywc(item.getWc());
               if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
                  itemVoListMon.stream().forEach(item1-> {
                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                        vo.setQnwc(item1.getWc());
                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
                        }
                     }
                  });
               }
               list.add(vo);
            });
            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
            vo.setYw(itemVoListMon.get(0).getYw());
            vo.setLb(itemVoListMon.get(0).getLb());
            vo.setDw("集团");
            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
            if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
               vo.setQnwc(itemVoListMonrLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
               }
            }
            list.add(vo);
         }
         List<GcpbkwcqkItemVo> itemVoListYear = contractInvoiceMapper.cksxywwcqk("1",yearstart,yearend);
         List<GcpbkwcqkItemVo> itemVoListYearLastYear = contractInvoiceMapper.cksxywwcqk("1",yearstartLastYear,yearendLastYear);
         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYear)){
            for (PjdxcksxywwcqkVo vo:list
            ) {
               for (GcpbkwcqkItemVo itemVo:itemVoListYear
               ) {
                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
                     vo.setLjwc(itemVo.getWc());
                  }
                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
                     itemVoListYearLastYear.stream().forEach(item1->{
                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                           vo.setQntq(item1.getWc());
                           vo.setLjtb(vo.getLjwc().subtract(item1.getWc()));
                           if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                              vo.setLjtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
                           }
                        }
                     });
                  }
               }
               if (StrUtil.equals(vo.getYw(),"出口")&&StrUtil.equals(vo.getLb(),"销售收入")&&
                     StrUtil.equals(vo.getDw(),"集团")){
                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
                     vo.setQntq(itemVoListYearLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
                     }
                  }
               }
            }
         }
         //配件合同
         List<GcpbkwcqkItemVo> itemVoListMonHT = contractMapper.cksxywwcqkHT("1",monstart,monend);
         List<GcpbkwcqkItemVo> itemVoListMonrHTLastYear = contractMapper.cksxywwcqkHT("1",monstartLastYear,monendLastYear);
         if (CollUtil.isNotEmpty(itemVoListMonHT)){
            itemVoListMonHT.stream().forEach(item->{
               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
               vo.setYw(item.getYw());
               vo.setLb(item.getLb());
               vo.setDw(item.getDw());
               vo.setDywc(item.getWc());
               if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
                  itemVoListMonrHTLastYear.stream().forEach(item1-> {
                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                        vo.setQnwc(item1.getWc());
                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
                        }
                     }
                  });
               }
               list.add(vo);
            });
            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
            vo.setYw(itemVoListMon.get(0).getYw());
            vo.setLb(itemVoListMon.get(0).getLb());
            vo.setDw("集团");
            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
            if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
               vo.setQnwc(itemVoListMonrHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
               }
            }
            list.add(vo);
         }
         List<GcpbkwcqkItemVo> itemVoListYearHT = contractMapper.cksxywwcqkHT("1",yearstart,yearend);
         List<GcpbkwcqkItemVo> itemVoListYearHTLastYear = contractMapper.cksxywwcqkHT("1",yearstartLastYear,yearendLastYear);
         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYearHT)){
            for (PjdxcksxywwcqkVo vo:list
            ) {
               for (GcpbkwcqkItemVo itemVo:itemVoListYearHT
               ) {
                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
                     vo.setLjwc(itemVo.getWc());
                  }
                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
                     itemVoListYearHTLastYear.stream().forEach(item1->{
                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
                           vo.setQntq(item1.getWc());
                           vo.setLjtb(vo.getLjwc().subtract(item1.getWc()));
                           if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
                              vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
                           }
                        }
                     });
                  }
               }
               if (StrUtil.equals(vo.getYw(),"出口")&&StrUtil.equals(vo.getLb(),"新增合同")&&
                     StrUtil.equals(vo.getDw(),"集团")){
                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
                     vo.setQntq(itemVoListYearHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
                     }
                  }
               }
            }
         }
      }
      if (CollUtil.isNotEmpty(list)){
         String[] arrLb = {"销售收入", "新增合同"};
         String[] arrDw = {"石煤机", "石工泵", "邢台厂", "通方厂","集团"};
         for (int i = 0; i < arrLb.length; i++) {
            for (int j = 0; j < arrDw.length; j++) {
               PjdxcksxywwcqkVo vosmj = new PjdxcksxywwcqkVo();
               vosmj.setYw("以上三项合计");
               String lb = arrLb[i];
               String dw = arrDw[j];
               vosmj.setLb(lb);
               vosmj.setDw(dw);
               vosmj.setDywc(list.stream().filter(item->item.getLb().equals(lb)&&item.getDw().equals(dw)).collect(Collectors.toList())
                     .stream().map(item->item.getDywc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
               vosmj.setQnwc(list.stream().filter(item->item.getLb().equals(lb)&&item.getDw().equals(dw)).collect(Collectors.toList())
                     .stream().map(item->item.getQnwc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
               vosmj.setYtb(vosmj.getDywc().subtract(vosmj.getQnwc()));
               if (vosmj.getQnwc().compareTo(new BigDecimal("0"))>0){
                  vosmj.setYtqb(vosmj.getYtb().divide(vosmj.getQnwc(),2,RoundingMode.HALF_UP)+"%");
               }
               vosmj.setLjwc(list.stream().filter(item->item.getLb().equals(lb)&&item.getDw().equals(dw)).collect(Collectors.toList())
                     .stream().map(item->item.getLjwc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
               vosmj.setQntq(list.stream().filter(item->item.getLb().equals(lb)&&item.getDw().equals(dw)).collect(Collectors.toList())
                     .stream().map(item->item.getQntq()).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
               vosmj.setLjtb(vosmj.getLjwc().subtract(vosmj.getQntq()));
               if (vosmj.getQntq().compareTo(new BigDecimal("0"))>0){
                  vosmj.setLjtqb(vosmj.getLjtb().divide(vosmj.getQntq(),2,RoundingMode.HALF_UP)+"%");
               }
               list.add(vosmj);
            }
         }
      }
//      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
//      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
//      Date monstartLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00"),-1);
//      Date monendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
//      Date yearstart = DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00");
//      Date yearend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
//      Date yearstartLastYear =  DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00"),-1);
//      Date yearendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
//
//      if (true){
//         //配件开票
//         List<GcpbkwcqkItemVo> itemVoListMon = contractInvoiceMapper.pjsxywwcqk("1",monstart,monend);
//         List<GcpbkwcqkItemVo> itemVoListMonrLastYear = contractInvoiceMapper.pjsxywwcqk("1",monstartLastYear,monstartLastYear);
//         if (CollUtil.isNotEmpty(itemVoListMon)){
//            itemVoListMon.stream().forEach(item->{
//               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//               vo.setYw(item.getYw());
//               vo.setLb(item.getLb());
//               vo.setDw(item.getDw());
//               vo.setDywc(item.getWc());
//               if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
//                  itemVoListMon.stream().forEach(item1-> {
//                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
//                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                        vo.setQnwc(item1.getWc());
//                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
//                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//                        }
//                     }
//                  });
//               }
//               list.add(vo);
//            });
//            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//            vo.setYw(itemVoListMon.get(0).getYw());
//            vo.setLb(itemVoListMon.get(0).getLb());
//            vo.setDw("集团");
//            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//            if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
//               vo.setQnwc(itemVoListMonrLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
//               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//               }
//
//            }
//            list.add(vo);
//         }
//         List<GcpbkwcqkItemVo> itemVoListYear = contractInvoiceMapper.pjsxywwcqk("1",yearstart,yearend);
//         List<GcpbkwcqkItemVo> itemVoListYearLastYear = contractInvoiceMapper.pjsxywwcqk("1",yearstartLastYear,yearendLastYear);
//         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYear)){
//            for (PjdxcksxywwcqkVo vo:list
//            ) {
//               for (GcpbkwcqkItemVo itemVo:itemVoListYear
//               ) {
//                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
//                     vo.setLjwc(itemVo.getWc());
//                  }
//                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
//                     itemVoListYearLastYear.stream().forEach(item1->{
//                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                           vo.setQntq(item1.getWc());
//                           vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
//                           if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
//                              vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
//                           }
//                        }
//                     });
//                  }
//               }
//               if (StrUtil.equals(vo.getYw(),"配件")&&StrUtil.equals(vo.getLb(),"销售收入")&&
//                     StrUtil.equals(vo.getDw(),"集团")){
//                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
//                     vo.setQntq(itemVoListYearLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
//                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
//                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
//                     }
//
//                  }
//               }
//            }
//         }
//         //配件合同
//         List<GcpbkwcqkItemVo> itemVoListMonHT = contractMapper.pjsxywwcqkHT("1",monstart,monend);
//         List<GcpbkwcqkItemVo> itemVoListMonrHTLastYear = contractMapper.pjsxywwcqkHT("1",monstartLastYear,monstartLastYear);
//         if (CollUtil.isNotEmpty(itemVoListMonHT)){
//            itemVoListMonHT.stream().forEach(item->{
//               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//               vo.setYw(item.getYw());
//               vo.setLb(item.getLb());
//               vo.setDw(item.getDw());
//               vo.setDywc(item.getWc());
//               if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
//                  itemVoListMonrHTLastYear.stream().forEach(item1-> {
//                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
//                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                        vo.setQnwc(item1.getWc());
//                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
//                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//                        }
//                     }
//                  });
//               }
//               list.add(vo);
//            });
//            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//            vo.setYw(itemVoListMon.get(0).getYw());
//            vo.setLb(itemVoListMon.get(0).getLb());
//            vo.setDw("集团");
//            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//            if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
//               vo.setQnwc(itemVoListMonrHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
//               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//               }
//            }
//            list.add(vo);
//         }
//         List<GcpbkwcqkItemVo> itemVoListYearHT = contractMapper.pjsxywwcqkHT("1",yearstart,yearend);
//         List<GcpbkwcqkItemVo> itemVoListYearHTLastYear = contractMapper.pjsxywwcqkHT("1",yearstartLastYear,yearendLastYear);
//         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYearHT)){
//            for (PjdxcksxywwcqkVo vo:list
//            ) {
//               for (GcpbkwcqkItemVo itemVo:itemVoListYearHT
//               ) {
//                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
//                     vo.setLjwc(itemVo.getWc());
//                  }
//                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
//                     itemVoListYearHTLastYear.stream().forEach(item1->{
//                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                           vo.setQntq(item1.getWc());
//                           vo.setLjtb(vo.getLjwc().subtract(item1.getWc()));
//                           if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
//                              vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
//                           }
//                        }
//                     });
//                  }
//               }
//               if (StrUtil.equals(vo.getYw(),"配件")&&StrUtil.equals(vo.getLb(),"新增合同")&&
//                     StrUtil.equals(vo.getDw(),"集团")){
//                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
//                     vo.setQntq(itemVoListYearHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
//                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
//                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
//                     }
//
//                  }
//               }
//            }
//         }
//      }
//      if (true){
//         //大修开票
//         List<GcpbkwcqkItemVo> itemVoListMon = contractInvoiceMapper.dxsxywwcqk("2",monstart,monend);
//         List<GcpbkwcqkItemVo> itemVoListMonrLastYear = contractInvoiceMapper.dxsxywwcqk("2",monstartLastYear,monendLastYear);
//         if (CollUtil.isNotEmpty(itemVoListMon)){
//            itemVoListMon.stream().forEach(item->{
//               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//               vo.setYw(item.getYw());
//               vo.setLb(item.getLb());
//               vo.setDw(item.getDw());
//               vo.setDywc(item.getWc());
//               if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
//                  itemVoListMon.stream().forEach(item1-> {
//                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
//                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                        vo.setQnwc(item1.getWc());
//                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
//                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//                        }
//                     }
//                  });
//               }
//               list.add(vo);
//            });
//            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//            vo.setYw(itemVoListMon.get(0).getYw());
//            vo.setLb(itemVoListMon.get(0).getLb());
//            vo.setDw("集团");
//            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//            if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
//               vo.setQnwc(itemVoListMonrLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
//               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//               }
//
//            }
//            list.add(vo);
//         }
//         List<GcpbkwcqkItemVo> itemVoListYear = contractInvoiceMapper.dxsxywwcqk("2",yearstart,yearend);
//         List<GcpbkwcqkItemVo> itemVoListYearLastYear = contractInvoiceMapper.dxsxywwcqk("2",yearstartLastYear,yearendLastYear);
//         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYear)){
//            for (PjdxcksxywwcqkVo vo:list
//            ) {
//               for (GcpbkwcqkItemVo itemVo:itemVoListYear
//               ) {
//                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
//                     vo.setLjwc(itemVo.getWc());
//                  }
//                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
//                     itemVoListYearLastYear.stream().forEach(item1->{
//                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                           vo.setQntq(item1.getWc());
//                           vo.setLjtb(vo.getLjwc().subtract(item1.getWc()));
//                           if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                              vo.setLjtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//                           }
//                        }
//                     });
//                  }
//               }
//               if (StrUtil.equals(vo.getYw(),"大修")&&StrUtil.equals(vo.getLb(),"销售收入")&&
//                     StrUtil.equals(vo.getDw(),"集团")){
//                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
//                     vo.setQntq(itemVoListYearLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
//                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
//                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
//                     }
//
//                  }
//               }
//            }
//         }
//         //大修合同
//         List<GcpbkwcqkItemVo> itemVoListMonHT = contractMapper.dxsxywwcqkHT("2",monstart,monend);
//         List<GcpbkwcqkItemVo> itemVoListMonrHTLastYear = contractMapper.dxsxywwcqkHT("2",monstartLastYear,monendLastYear);
//         if (CollUtil.isNotEmpty(itemVoListMonHT)){
//            itemVoListMonHT.stream().forEach(item->{
//               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//               vo.setYw(item.getYw());
//               vo.setLb(item.getLb());
//               vo.setDw(item.getDw());
//               vo.setDywc(item.getWc());
//               if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
//                  itemVoListMonrHTLastYear.stream().forEach(item1-> {
//                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
//                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                        vo.setQnwc(item1.getWc());
//                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
//                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//                        }
//                     }
//                  });
//               }
//               list.add(vo);
//            });
//            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//            vo.setYw(itemVoListMon.get(0).getYw());
//            vo.setLb(itemVoListMon.get(0).getLb());
//            vo.setDw("集团");
//            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//            if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
//               vo.setQnwc(itemVoListMonrHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
//               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//               }
//
//            }
//            list.add(vo);
//         }
//         List<GcpbkwcqkItemVo> itemVoListYearHT = contractMapper.dxsxywwcqkHT("2",yearstart,yearend);
//         List<GcpbkwcqkItemVo> itemVoListYearHTLastYear = contractMapper.dxsxywwcqkHT("2",yearstartLastYear,yearendLastYear);
//         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYearHT)){
//            for (PjdxcksxywwcqkVo vo:list
//            ) {
//               for (GcpbkwcqkItemVo itemVo:itemVoListYearHT
//               ) {
//                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
//                     vo.setLjwc(itemVo.getWc());
//                  }
//                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
//                     itemVoListYearHTLastYear.stream().forEach(item1->{
//                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                           vo.setQntq(item1.getWc());
//                           vo.setLjtb(vo.getLjwc().subtract(item1.getWc()));
//                           if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                              vo.setLjtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//                           }
//                        }
//                     });
//                  }
//               }
//               if (StrUtil.equals(vo.getYw(),"大修")&&StrUtil.equals(vo.getLb(),"新增合同")&&
//                     StrUtil.equals(vo.getDw(),"集团")){
//                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
//                     vo.setQntq(itemVoListYearHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
//                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
//                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
//                     }
//
//                  }
//               }
//            }
//         }
//      }
//      if (true){
//         //出口开票
//         List<GcpbkwcqkItemVo> itemVoListMon = contractInvoiceMapper.cksxywwcqk("1",monstart,monend);
//         List<GcpbkwcqkItemVo> itemVoListMonrLastYear = contractInvoiceMapper.cksxywwcqk("1",monstartLastYear,monendLastYear);
//         if (CollUtil.isNotEmpty(itemVoListMon)){
//            itemVoListMon.stream().forEach(item->{
//               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//               vo.setYw(item.getYw());
//               vo.setLb(item.getLb());
//               vo.setDw(item.getDw());
//               vo.setDywc(item.getWc());
//               if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
//                  itemVoListMon.stream().forEach(item1-> {
//                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
//                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                        vo.setQnwc(item1.getWc());
//                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
//                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//                        }
//                     }
//                  });
//               }
//               list.add(vo);
//            });
//            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//            vo.setYw(itemVoListMon.get(0).getYw());
//            vo.setLb(itemVoListMon.get(0).getLb());
//            vo.setDw("集团");
//            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//            if (CollUtil.isNotEmpty(itemVoListMonrLastYear)){
//               vo.setQnwc(itemVoListMonrLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
//               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//               }
//            }
//            list.add(vo);
//         }
//         List<GcpbkwcqkItemVo> itemVoListYear = contractInvoiceMapper.cksxywwcqk("1",yearstart,yearend);
//         List<GcpbkwcqkItemVo> itemVoListYearLastYear = contractInvoiceMapper.cksxywwcqk("1",yearstartLastYear,yearendLastYear);
//         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYear)){
//            for (PjdxcksxywwcqkVo vo:list
//            ) {
//               for (GcpbkwcqkItemVo itemVo:itemVoListYear
//               ) {
//                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
//                     vo.setLjwc(itemVo.getWc());
//                  }
//                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
//                     itemVoListYearLastYear.stream().forEach(item1->{
//                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                           vo.setQntq(item1.getWc());
//                           vo.setLjtb(vo.getLjwc().subtract(item1.getWc()));
//                           if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                              vo.setLjtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//                           }
//                        }
//                     });
//                  }
//               }
//               if (StrUtil.equals(vo.getYw(),"出口")&&StrUtil.equals(vo.getLb(),"销售收入")&&
//                     StrUtil.equals(vo.getDw(),"集团")){
//                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                  if (CollUtil.isNotEmpty(itemVoListYearLastYear)){
//                     vo.setQntq(itemVoListYearLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
//                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
//                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
//                     }
//                  }
//               }
//            }
//         }
//         //配件合同
//         List<GcpbkwcqkItemVo> itemVoListMonHT = contractMapper.cksxywwcqkHT("1",monstart,monend);
//         List<GcpbkwcqkItemVo> itemVoListMonrHTLastYear = contractMapper.cksxywwcqkHT("1",monstartLastYear,monendLastYear);
//         if (CollUtil.isNotEmpty(itemVoListMonHT)){
//            itemVoListMonHT.stream().forEach(item->{
//               PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//               vo.setYw(item.getYw());
//               vo.setLb(item.getLb());
//               vo.setDw(item.getDw());
//               vo.setDywc(item.getWc());
//               if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
//                  itemVoListMonrHTLastYear.stream().forEach(item1-> {
//                     if (StrUtil.equals(vo.getYw(),item1.getYw())&&StrUtil.equals(vo.getLb(),item1.getLb())&&
//                           StrUtil.equals(vo.getDw(),item1.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                        vo.setQnwc(item1.getWc());
//                        vo.setYtb(vo.getDywc().subtract(item1.getWc()));
//                        if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                           vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//                        }
//                     }
//                  });
//               }
//               list.add(vo);
//            });
//            PjdxcksxywwcqkVo vo = new PjdxcksxywwcqkVo();
//            vo.setYw(itemVoListMon.get(0).getYw());
//            vo.setLb(itemVoListMon.get(0).getLb());
//            vo.setDw("集团");
//            vo.setDywc(itemVoListMon.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//            if (CollUtil.isNotEmpty(itemVoListMonrHTLastYear)){
//               vo.setQnwc(itemVoListMonrHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//               vo.setYtb(vo.getDywc().subtract(vo.getQnwc()));
//               if (vo.getQnwc().compareTo(new BigDecimal("0"))>0) {
//                  vo.setYtqb(vo.getYtb().divide(vo.getQnwc(), 2, RoundingMode.HALF_UP) + "%");
//               }
//
//            }
//            list.add(vo);
//         }
//         List<GcpbkwcqkItemVo> itemVoListYearHT = contractMapper.cksxywwcqkHT("1",yearstart,yearend);
//         List<GcpbkwcqkItemVo> itemVoListYearHTLastYear = contractMapper.cksxywwcqkHT("1",yearstartLastYear,yearendLastYear);
//         if (CollUtil.isNotEmpty(list)&&CollUtil.isNotEmpty(itemVoListYearHT)){
//            for (PjdxcksxywwcqkVo vo:list
//            ) {
//               for (GcpbkwcqkItemVo itemVo:itemVoListYearHT
//               ) {
//                  if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                        StrUtil.equals(vo.getDw(),itemVo.getDw())){
//                     vo.setLjwc(itemVo.getWc());
//                  }
//                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
//                     itemVoListYearHTLastYear.stream().forEach(item1->{
//                        if (StrUtil.equals(vo.getYw(),itemVo.getYw())&&StrUtil.equals(vo.getLb(),itemVo.getLb())&&
//                              StrUtil.equals(vo.getDw(),itemVo.getDw())&&item1.getWc().compareTo(new BigDecimal("0"))>0){
//                           vo.setQntq(item1.getWc());
//                           vo.setLjtb(vo.getLjwc().subtract(item1.getWc()));
//                           if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
//                              vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
//                           }
//                        }
//                     });
//                  }
//               }
//               if (StrUtil.equals(vo.getYw(),"出口")&&StrUtil.equals(vo.getLb(),"新增合同")&&
//                     StrUtil.equals(vo.getDw(),"集团")){
//                  vo.setLjwc(itemVoListYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                  if (CollUtil.isNotEmpty(itemVoListYearHTLastYear)){
//                     vo.setQntq(itemVoListYearHTLastYear.stream().map(GcpbkwcqkItemVo::getWc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//                     vo.setLjtb(vo.getLjwc().subtract(vo.getQntq()));
//                     if (vo.getQntq().compareTo(new BigDecimal("0"))>0) {
//                        vo.setLjtqb(vo.getLjtb().divide(vo.getQntq(), 2, RoundingMode.HALF_UP) + "%");
//                     }
//
//                  }
//               }
//            }
//         }
//      }
//      if (CollUtil.isNotEmpty(list)){
//         String[] arrLb = {"销售收入", "新增合同"};
//         String[] arrDw = {"石煤机", "石工泵", "邢台厂", "通方厂","集团"};
//         for (int i = 0; i < arrLb.length; i++) {
//            for (int j = 0; j < arrDw.length; j++) {
//               PjdxcksxywwcqkVo vosmj = new PjdxcksxywwcqkVo();
//               vosmj.setYw("以上三项合计");
//               String lb = arrLb[i];
//               String dw = arrDw[j];
//               vosmj.setLb(lb);
//               vosmj.setDw(dw);
//               vosmj.setDywc(list.stream().filter(item->item.getLb().equals(lb)&&item.getDw().equals(dw)).collect(Collectors.toList())
//                     .stream().map(item->item.getDywc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//               vosmj.setQnwc(list.stream().filter(item->item.getLb().equals(lb)&&item.getDw().equals(dw)).collect(Collectors.toList())
//                     .stream().map(item->item.getQnwc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//               vosmj.setYtb(vosmj.getDywc().subtract(vosmj.getQnwc()));
//               if (vosmj.getQnwc().compareTo(new BigDecimal("0"))>0){
//                  vosmj.setYtqb(vosmj.getYtb().divide(vosmj.getQnwc(),2,RoundingMode.HALF_UP)+"%");
//               }
//               vosmj.setLjwc(list.stream().filter(item->item.getLb().equals(lb)&&item.getDw().equals(dw)).collect(Collectors.toList())
//                     .stream().map(item->item.getLjwc()).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//               vosmj.setQntq(list.stream().filter(item->item.getLb().equals(lb)&&item.getDw().equals(dw)).collect(Collectors.toList())
//                     .stream().map(item->item.getQntq()).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
//               vosmj.setLjtb(vosmj.getLjwc().subtract(vosmj.getQntq()));
//               if (vosmj.getQntq().compareTo(new BigDecimal("0"))>0){
//                  vosmj.setLjtqb(vosmj.getLjtb().divide(vosmj.getQntq(),2,RoundingMode.HALF_UP)+"%");
//               }
//               list.add(vosmj);
//            }
//         }
//      }
      return R.ok(list);
   }
@@ -1131,66 +1160,72 @@
      if (StrUtil.isBlank(queryDTO.getYearMonth())){
         return R.failed("查询年月不能为空");
      }
      List<ZbStatisticCpXzht> xszbList = zbStatisticCpXzhtMapper.selectList(Wrappers.<ZbStatisticCpXzht>lambdaQuery()
            .eq(ZbStatisticCpXzht::getStatYm,queryDTO.getYearMonth()).orderByAsc(ZbStatisticCpXzht::getSort));
      if (CollUtil.isNotEmpty(xszbList)){
         List<CpxssrwcqkVo> list = BeanUtil.copyToList(xszbList,CpxssrwcqkVo.class);
         return R.ok(list);
      }
      List<CpxssrwcqkVo> list = new ArrayList<>();
      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date monstartLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00"),-1);
      Date monendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
      Date yearstart = DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00");
      Date yearend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date yearstartLastYear =  DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00"),-1);
      Date yearendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
      List<CpxssrwcqkItemVo> itemVoListDY = contractSubjectMatterMapper.cpxzhtwcqk(monstart,monend);
      List<CpxssrwcqkItemVo> itemVoListLJ = contractSubjectMatterMapper.cpxzhtwcqk(yearstart,yearend);
      List<CpxssrwcqkItemVo> itemVoListQN = contractSubjectMatterMapper.cpxzhtwcqk(yearstartLastYear,yearendLastYear);
      List<Integer> indexList = new ArrayList<>();
      if (CollUtil.isNotEmpty(itemVoListDY)){
         for (int i = 0; i < itemVoListDY.size(); i++) {
            CpxssrwcqkItemVo item = itemVoListDY.get(i);
            CpxssrwcqkVo vo = new CpxssrwcqkVo();
            vo.setXm(item.getXm());
            BipDict dict = bipDictMapper.selectOne(Wrappers.<BipDict>lambdaQuery().eq(BipDict::getDictKey,"zb-cpmc")
                  .eq(BipDict::getParentId,0).eq(BipDict::getDictName,item.getXm()).last("limit 1"));
            if (ObjUtil.isNull(dict)) {
               vo.setDyxsl(item.getXsl());
               vo.setDyxssr(item.getXssr());
               if (CollUtil.isNotEmpty(itemVoListLJ)) {
                  itemVoListLJ.stream().forEach(item1 -> {
                     if (StrUtil.equals(vo.getXm(), item1.getXm())) {
                        vo.setLjxsl(item1.getXsl());
                        vo.setLjxssr(item1.getXssr());
                     }
                  });
               }
               if (CollUtil.isNotEmpty(itemVoListQN)) {
                  itemVoListQN.stream().forEach(item1 -> {
                     if (StrUtil.equals(vo.getXm(), item1.getXm())) {
                        vo.setQnljxsl(item1.getXsl());
                        vo.setQnljxssr(item1.getXssr());
                        vo.setTqbxsl(vo.getLjxsl().subtract(vo.getQnljxsl()));
                        vo.setTqbxssr(vo.getLjxssr().subtract(vo.getQnljxssr()));
                     }
                  });
               }
            }else {
               indexList.add(i);
            }
            list.add(vo);
         }
         indexList.add(itemVoListDY.size());
         for (int i = 0; i < indexList.size()-1; i++) {
            List<CpxssrwcqkVo> sublist = list.subList(i,i+1);
            list.get(i).setDyxsl(sublist.stream().map(item->item.getDyxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setDyxssr(sublist.stream().map(item->item.getDyxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setLjxsl(sublist.stream().map(item->item.getLjxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setLjxssr(sublist.stream().map(item->item.getLjxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setQnljxsl(sublist.stream().map(item->item.getQnljxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setQnljxssr(sublist.stream().map(item->item.getQnljxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setTqbxsl(list.get(i).getLjxsl().subtract(list.get(i).getQnljxsl()));
            list.get(i).setTqbxssr(list.get(i).getLjxssr().subtract(list.get(i).getQnljxssr()));
         }
      }
//      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
//      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
//      Date monstartLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00"),-1);
//      Date monendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
//      Date yearstart = DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00");
//      Date yearend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
//      Date yearstartLastYear =  DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00"),-1);
//      Date yearendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
//
//      List<CpxssrwcqkItemVo> itemVoListDY = contractSubjectMatterMapper.cpxzhtwcqk(monstart,monend);
//      List<CpxssrwcqkItemVo> itemVoListLJ = contractSubjectMatterMapper.cpxzhtwcqk(yearstart,yearend);
//      List<CpxssrwcqkItemVo> itemVoListQN = contractSubjectMatterMapper.cpxzhtwcqk(yearstartLastYear,yearendLastYear);
//      List<Integer> indexList = new ArrayList<>();
//      if (CollUtil.isNotEmpty(itemVoListDY)){
//         for (int i = 0; i < itemVoListDY.size(); i++) {
//            CpxssrwcqkItemVo item = itemVoListDY.get(i);
//            CpxssrwcqkVo vo = new CpxssrwcqkVo();
//            vo.setXm(item.getXm());
//            BipDict dict = bipDictMapper.selectOne(Wrappers.<BipDict>lambdaQuery().eq(BipDict::getDictKey,"zb-cpmc")
//                  .eq(BipDict::getParentId,0).eq(BipDict::getDictName,item.getXm()).last("limit 1"));
//            if (ObjUtil.isNull(dict)) {
//               vo.setDyxsl(item.getXsl());
//               vo.setDyxssr(item.getXssr());
//               if (CollUtil.isNotEmpty(itemVoListLJ)) {
//                  itemVoListLJ.stream().forEach(item1 -> {
//                     if (StrUtil.equals(vo.getXm(), item1.getXm())) {
//                        vo.setLjxsl(item1.getXsl());
//                        vo.setLjxssr(item1.getXssr());
//                     }
//                  });
//               }
//               if (CollUtil.isNotEmpty(itemVoListQN)) {
//                  itemVoListQN.stream().forEach(item1 -> {
//                     if (StrUtil.equals(vo.getXm(), item1.getXm())) {
//                        vo.setQnljxsl(item1.getXsl());
//                        vo.setQnljxssr(item1.getXssr());
//                        vo.setTqbxsl(vo.getLjxsl().subtract(vo.getQnljxsl()));
//                        vo.setTqbxssr(vo.getLjxssr().subtract(vo.getQnljxssr()));
//                     }
//                  });
//               }
//            }else {
//               indexList.add(i);
//            }
//            list.add(vo);
//         }
//         indexList.add(itemVoListDY.size());
//         for (int i = 0; i < indexList.size()-1; i++) {
//            List<CpxssrwcqkVo> sublist = list.subList(i,i+1);
//            list.get(i).setDyxsl(sublist.stream().map(item->item.getDyxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setDyxssr(sublist.stream().map(item->item.getDyxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setLjxsl(sublist.stream().map(item->item.getLjxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setLjxssr(sublist.stream().map(item->item.getLjxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setQnljxsl(sublist.stream().map(item->item.getQnljxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setQnljxssr(sublist.stream().map(item->item.getQnljxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setTqbxsl(list.get(i).getLjxsl().subtract(list.get(i).getQnljxsl()));
//            list.get(i).setTqbxssr(list.get(i).getLjxssr().subtract(list.get(i).getQnljxssr()));
//         }
//      }
      return R.ok(list);
   }
@@ -1303,65 +1338,191 @@
      if (StrUtil.isBlank(queryDTO.getYearMonth())){
         return R.failed("查询年月不能为空");
      }
      List<ZbStatisticCpXssr> xszbList = zbStatisticCpXssrMapper.selectList(Wrappers.<ZbStatisticCpXssr>lambdaQuery()
            .eq(ZbStatisticCpXssr::getStatYm,queryDTO.getYearMonth()).orderByAsc(ZbStatisticCpXssr::getSort));
      if (CollUtil.isNotEmpty(xszbList)){
         List<CpxssrwcqkVo> list = BeanUtil.copyToList(xszbList,CpxssrwcqkVo.class);
         return R.ok(list);
      }
      List<CpxssrwcqkVo> list = new ArrayList<>();
//      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
//      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
//      Date monstartLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00"),-1);
//      Date monendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
//      Date yearstart = DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00");
//      Date yearend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
//      Date yearstartLastYear =  DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00"),-1);
//      Date yearendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
//
//      List<CpxssrwcqkItemVo> itemVoListDY = contractOutBoundMapper.cpxssrwcqk(monstart,monend);
//      List<CpxssrwcqkItemVo> itemVoListLJ = contractOutBoundMapper.cpxssrwcqk(yearstart,yearend);
//      List<CpxssrwcqkItemVo> itemVoListQN = contractOutBoundMapper.cpxssrwcqk(yearstartLastYear,yearendLastYear);
//      List<Integer> indexList = new ArrayList<>();
//      if (CollUtil.isNotEmpty(itemVoListDY)){
//         for (int i = 0; i < itemVoListDY.size(); i++) {
//            CpxssrwcqkItemVo item = itemVoListDY.get(i);
//            CpxssrwcqkVo vo = new CpxssrwcqkVo();
//            vo.setXm(item.getXm());
//            BipDict dict = bipDictMapper.selectOne(Wrappers.<BipDict>lambdaQuery().eq(BipDict::getDictKey,"zb-cpmc")
//                  .eq(BipDict::getParentId,0).eq(BipDict::getDictName,item.getXm()).last("limit 1"));
//            if (ObjUtil.isNull(dict)) {
//               vo.setDyxsl(item.getXsl());
//               vo.setDyxssr(item.getXssr());
//               if (CollUtil.isNotEmpty(itemVoListLJ)) {
//                  itemVoListLJ.stream().forEach(item1 -> {
//                     if (StrUtil.equals(vo.getXm(), item1.getXm())) {
//                        vo.setLjxsl(item1.getXsl());
//                        vo.setLjxssr(item1.getXssr());
//                     }
//                  });
//               }
//               if (CollUtil.isNotEmpty(itemVoListQN)) {
//                  itemVoListQN.stream().forEach(item1 -> {
//                     if (StrUtil.equals(vo.getXm(), item1.getXm())) {
//                        vo.setQnljxsl(item1.getXsl());
//                        vo.setQnljxssr(item1.getXssr());
//                        vo.setTqbxsl(vo.getLjxsl().subtract(vo.getQnljxsl()));
//                        vo.setTqbxssr(vo.getLjxssr().subtract(vo.getQnljxssr()));
//                     }
//                  });
//               }
//            }else {
//               indexList.add(i);
//            }
//            list.add(vo);
//         }
//         indexList.add(itemVoListDY.size());
//         for (int i = 0; i < indexList.size()-1; i++) {
//            List<CpxssrwcqkVo> sublist = list.subList(i,i+1);
//            list.get(i).setDyxsl(sublist.stream().map(item->item.getDyxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setDyxssr(sublist.stream().map(item->item.getDyxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setLjxsl(sublist.stream().map(item->item.getLjxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setLjxssr(sublist.stream().map(item->item.getLjxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setQnljxsl(sublist.stream().map(item->item.getQnljxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setQnljxssr(sublist.stream().map(item->item.getQnljxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
//            list.get(i).setTqbxsl(list.get(i).getLjxsl().subtract(list.get(i).getQnljxsl()));
//            list.get(i).setTqbxssr(list.get(i).getLjxssr().subtract(list.get(i).getQnljxssr()));
//         }
//      }
      return R.ok(list);
   }
   @Override
   public R zbjtjznbyszk(ZBJTStatisticDTO queryDTO) {
      if (StrUtil.isBlank(queryDTO.getYearMonth())){
         return R.failed("查询年月不能为空");
      }
      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date monstartLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00"),-1);
      Date monendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
      Date yearstart = DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00");
      Date yearend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date yearstartLastYear =  DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth().substring(0,4)+"-01-01 00:00:00"),-1);
      Date yearendLastYear = DateUtil.offsetYear(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),-1);
      Date mon2after = DateUtil.offsetMonth(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),2);
      List<CpxssrwcqkItemVo> itemVoListDY = contractOutBoundMapper.cpxssrwcqk(monstart,monend);
      List<CpxssrwcqkItemVo> itemVoListLJ = contractOutBoundMapper.cpxssrwcqk(yearstart,yearend);
      List<CpxssrwcqkItemVo> itemVoListQN = contractOutBoundMapper.cpxssrwcqk(yearstartLastYear,yearendLastYear);
      List<Integer> indexList = new ArrayList<>();
      if (CollUtil.isNotEmpty(itemVoListDY)){
         for (int i = 0; i < itemVoListDY.size(); i++) {
            CpxssrwcqkItemVo item = itemVoListDY.get(i);
            CpxssrwcqkVo vo = new CpxssrwcqkVo();
            vo.setXm(item.getXm());
            BipDict dict = bipDictMapper.selectOne(Wrappers.<BipDict>lambdaQuery().eq(BipDict::getDictKey,"zb-cpmc")
                  .eq(BipDict::getParentId,0).eq(BipDict::getDictName,item.getXm()).last("limit 1"));
            if (ObjUtil.isNull(dict)) {
               vo.setDyxsl(item.getXsl());
               vo.setDyxssr(item.getXssr());
               if (CollUtil.isNotEmpty(itemVoListLJ)) {
                  itemVoListLJ.stream().forEach(item1 -> {
                     if (StrUtil.equals(vo.getXm(), item1.getXm())) {
                        vo.setLjxsl(item1.getXsl());
                        vo.setLjxssr(item1.getXssr());
                     }
                  });
               }
               if (CollUtil.isNotEmpty(itemVoListQN)) {
                  itemVoListQN.stream().forEach(item1 -> {
                     if (StrUtil.equals(vo.getXm(), item1.getXm())) {
                        vo.setQnljxsl(item1.getXsl());
                        vo.setQnljxssr(item1.getXssr());
                        vo.setTqbxsl(vo.getLjxsl().subtract(vo.getQnljxsl()));
                        vo.setTqbxssr(vo.getLjxssr().subtract(vo.getQnljxssr()));
                     }
                  });
               }
            }else {
               indexList.add(i);
            }
      List<JznbyszkVo> list = paymentReceiveMapper.zbjtjznbyszk(null,mon2after,monend,mon2after);
      if (CollUtil.isNotEmpty(list)){
         JznbyszkVo vo = new JznbyszkVo();
         vo.setZgs("以上合计");
         vo.setWfyssx(list.stream().map(JznbyszkVo::getWfyssx).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setDfgz(list.stream().map(JznbyszkVo::getDfgz).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setSx(list.stream().map(JznbyszkVo::getSx).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setHxhtze(list.stream().map(JznbyszkVo::getHxhtze).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setLynjhht(list.stream().map(JznbyszkVo::getLynjhht).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setLywjhht(list.stream().map(JznbyszkVo::getLywjhht).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.add(vo);
         }
         indexList.add(itemVoListDY.size());
         for (int i = 0; i < indexList.size()-1; i++) {
            List<CpxssrwcqkVo> sublist = list.subList(i,i+1);
            list.get(i).setDyxsl(sublist.stream().map(item->item.getDyxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setDyxssr(sublist.stream().map(item->item.getDyxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setLjxsl(sublist.stream().map(item->item.getLjxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setLjxssr(sublist.stream().map(item->item.getLjxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setQnljxsl(sublist.stream().map(item->item.getQnljxsl()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setQnljxssr(sublist.stream().map(item->item.getQnljxssr()).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
            list.get(i).setTqbxsl(list.get(i).getLjxsl().subtract(list.get(i).getQnljxsl()));
            list.get(i).setTqbxssr(list.get(i).getLjxssr().subtract(list.get(i).getQnljxssr()));
      return R.ok(list);
         }
   @Override
   public R smjjznbyszk(ZBJTStatisticDTO queryDTO) {
      if (StrUtil.isBlank(queryDTO.getYearMonth())){
         return R.failed("查询年月不能为空");
      }
      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date mon2after = DateUtil.offsetMonth(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),2);
      List<JznbyszkVo> list = paymentReceiveMapper.zbjtjznbyszkSMJ(null,mon2after,monend,mon2after);
      if (CollUtil.isNotEmpty(list)){
         JznbyszkVo vo = new JznbyszkVo();
         vo.setZgs("以上合计");
         vo.setWfyssx(list.stream().map(JznbyszkVo::getWfyssx).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setDfgz(list.stream().map(JznbyszkVo::getDfgz).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setSx(list.stream().map(JznbyszkVo::getSx).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setHxhtze(list.stream().map(JznbyszkVo::getHxhtze).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setLynjhht(list.stream().map(JznbyszkVo::getLynjhht).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setLywjhht(list.stream().map(JznbyszkVo::getLywjhht).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         list.add(vo);
      }
      return R.ok(list);
   }
   @Override
   public R sgbjznbyszk(ZBJTStatisticDTO queryDTO) {
      if (StrUtil.isBlank(queryDTO.getYearMonth())){
         return R.failed("查询年月不能为空");
      }
      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date mon2after = DateUtil.offsetMonth(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),2);
      List<JznbyszkVo> list = paymentReceiveMapper.zbjtjznbyszk(2056556196124250113L,mon2after,monend,mon2after);
      if (CollUtil.isNotEmpty(list)){
         JznbyszkVo vo = new JznbyszkVo();
         vo.setZgs("以上合计");
         vo.setWfyssx(list.stream().map(JznbyszkVo::getWfyssx).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setDfgz(list.stream().map(JznbyszkVo::getDfgz).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setSx(list.stream().map(JznbyszkVo::getSx).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setHxhtze(list.stream().map(JznbyszkVo::getHxhtze).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setLynjhht(list.stream().map(JznbyszkVo::getLynjhht).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setLywjhht(list.stream().map(JznbyszkVo::getLywjhht).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         list.add(vo);
      }
      return R.ok(list);
   }
   @Override
   public R jxcjznbyszk(ZBJTStatisticDTO queryDTO) {
      if (StrUtil.isBlank(queryDTO.getYearMonth())){
         return R.failed("查询年月不能为空");
      }
      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date mon2after = DateUtil.offsetMonth(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),2);
      List<JznbyszkVo> list = paymentReceiveMapper.zbjtjznbyszk(2056556317461270529L,mon2after,monend,mon2after);
      if (CollUtil.isNotEmpty(list)){
         JznbyszkVo vo = new JznbyszkVo();
         vo.setZgs("以上合计");
         vo.setWfyssx(list.stream().map(JznbyszkVo::getWfyssx).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setDfgz(list.stream().map(JznbyszkVo::getDfgz).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setSx(list.stream().map(JznbyszkVo::getSx).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setHxhtze(list.stream().map(JznbyszkVo::getHxhtze).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setLynjhht(list.stream().map(JznbyszkVo::getLynjhht).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setLywjhht(list.stream().map(JznbyszkVo::getLywjhht).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         list.add(vo);
      }
      return R.ok(list);
   }
   @Override
   public R tfgsjznbyszk(ZBJTStatisticDTO queryDTO) {
      if (StrUtil.isBlank(queryDTO.getYearMonth())){
         return R.failed("查询年月不能为空");
      }
      Date monstart = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-01 00:00:00");
      Date monend = DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59");
      Date mon2after = DateUtil.offsetMonth(DateUtil.parseDateTime(queryDTO.getYearMonth()+"-31 23:59:59"),2);
      List<JznbyszkVo> list = paymentReceiveMapper.zbjtjznbyszk(2056556421857497090L,mon2after,monend,mon2after);
      if (CollUtil.isNotEmpty(list)){
         JznbyszkVo vo = new JznbyszkVo();
         vo.setZgs("以上合计");
         vo.setWfyssx(list.stream().map(JznbyszkVo::getWfyssx).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setDfgz(list.stream().map(JznbyszkVo::getDfgz).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setSx(list.stream().map(JznbyszkVo::getSx).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setHxhtze(list.stream().map(JznbyszkVo::getHxhtze).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setLynjhht(list.stream().map(JznbyszkVo::getLynjhht).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         vo.setLywjhht(list.stream().map(JznbyszkVo::getLywjhht).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
         list.add(vo);
      }
      return R.ok(list);
   }