From cc9dcfec975f6a10121be67eac6d029d159b9460 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期二, 20 十月 2026 14:19:42 +0800
Subject: [PATCH] feat:长期协议,不定期新增单位,标的物 历史导入标的物,根据接口查询 石煤机乙方总公司选总公司 和 分公司 银行流水加 时间拉取 流水数据 产品加拉取按钮 盖章件关闭控制

---
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java |  579 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 512 insertions(+), 67 deletions(-)

diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java
index ade6a99..de879af 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java
@@ -1,8 +1,10 @@
 package com.by4cloud.platformx.business.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.by4cloud.platformx.admin.api.entity.SysDept;
@@ -29,9 +31,7 @@
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
@@ -47,6 +47,8 @@
 	private final ContractInvoiceMapper contractInvoiceMapper;
 	private final CurrentOverdueMapper currentOverdueMapper;
 	private final HistoryOverdueMapper historyOverdueMapper;
+	private final AnnualPlanMapper annualPlanMapper;
+	private final PaymentReceiveMapper paymentReceiveMapper;
 	private final RemoteDeptService remoteDeptService;
 	private final RemoteDictService remoteDictService;
 
@@ -69,7 +71,6 @@
 	public R contractAmountAnalysis(AnalysisCommonDTO commonDTO) {
 		List<Long> compIds = new ArrayList<>();
 		compIds.add(Long.valueOf(sgb));
-		compIds.add(Long.valueOf(smj));
 		compIds.add(Long.valueOf(tfgs));
 		compIds.add(Long.valueOf(ymj));
 		compIds.add(Long.valueOf(jxc));
@@ -477,11 +478,12 @@
 			return R.failed("琛屼笟瀛楀吀鍒嗙被鑾峰彇寮傚父");
 		}
 		List<Long> compIds = new ArrayList<>();
-		compIds.add(Long.valueOf(sgb));
 		compIds.add(Long.valueOf(smj));
+		compIds.add(Long.valueOf(sgb));
+		compIds.add(Long.valueOf(jxc));
 		compIds.add(Long.valueOf(tfgs));
 		compIds.add(Long.valueOf(ymj));
-		compIds.add(Long.valueOf(jxc));
+
 
 		List<AgingAnalysisVo> result = new ArrayList<>();
 		AgingQueryDTO queryDTO = new AgingQueryDTO();
@@ -576,11 +578,11 @@
 	public R agingAnalysis(AnalysisCommonDTO commonDTO) {
 		if (commonDTO.getAgingType().equals("2")) {
 			List<Long> compIds = new ArrayList<>();
-			compIds.add(Long.valueOf(sgb));
 			compIds.add(Long.valueOf(smj));
+			compIds.add(Long.valueOf(sgb));
+			compIds.add(Long.valueOf(jxc));
 			compIds.add(Long.valueOf(tfgs));
 			compIds.add(Long.valueOf(ymj));
-			compIds.add(Long.valueOf(jxc));
 			List<AgingAnalysisVo> result = new ArrayList<>();
 			AgingQueryDTO queryDTO = new AgingQueryDTO();
 			List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotalShip(null);
@@ -591,7 +593,7 @@
 				}
 				SysDept dept = r.getData();
 				AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
-				agingAnalysisVo.setCompanyName(dept.getOrgName());
+				agingAnalysisVo.setCompanyName(dept.getName());
 				queryDTO.setCompanyId(dept.getDeptId());
 				List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotalShip(queryDTO);
 				//琛ュ叏鏁版嵁
@@ -688,7 +690,7 @@
 				}
 				SysDept dept = r.getData();
 				AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
-				agingAnalysisVo.setCompanyName(dept.getOrgName());
+				agingAnalysisVo.setCompanyName(dept.getName());
 				queryDTO.setCompanyId(dept.getDeptId());
 				List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotalInvoice(queryDTO);
 				//琛ュ叏鏁版嵁
@@ -867,11 +869,12 @@
 	@Override
 	public R agingAnalysisTotalScale(AnalysisCommonDTO commonDTO) {
 		List<Long> compIds = new ArrayList<>();
-		compIds.add(Long.valueOf(sgb));
 		compIds.add(Long.valueOf(smj));
+		compIds.add(Long.valueOf(sgb));
 		compIds.add(Long.valueOf(tfgs));
-		compIds.add(Long.valueOf(ymj));
 		compIds.add(Long.valueOf(jxc));
+		compIds.add(Long.valueOf(ymj));
+
 		List<AgingAnalysisVo> result = new ArrayList<>();
 		AgingQueryDTO queryDTO = new AgingQueryDTO();
 		List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotalScale(null);
@@ -882,7 +885,7 @@
 			}
 			SysDept dept = r.getData();
 			AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
-			agingAnalysisVo.setCompanyName(dept.getOrgName());
+			agingAnalysisVo.setCompanyName(dept.getName());
 			queryDTO.setCompanyId(dept.getDeptId());
 			List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotalScale(queryDTO);
 			//琛ュ叏鏁版嵁
@@ -966,95 +969,99 @@
 	@Override
 	public R homeZbjt() {
 		List<HomeZbjtVo> homeZbjtVoList = new ArrayList<>();
-		//鍚堝悓绛捐 sgb smj jxc tfgs ymj
-		HomeZbjtVo htqd = contractMapper.homeZbjt();
-		homeZbjtVoList.add(htqd);
-		//鍥炴
-		HomeZbjtVo hk = paymentSlipMapper.homeZbjt();
-		homeZbjtVoList.add(hk);
+
 		//鍑鸿揣
-		HomeZbjtVo ch = contractOutBoundMapper.homeZbjt();
-		homeZbjtVoList.add(ch);
+//		HomeZbjtVo ch = contractOutBoundMapper.homeZbjt();
+//		homeZbjtVoList.add(ch);
+		//鍙繚鐣欓攢鍞敹鍏� 鍥炴 鏂板鍚堝悓
 		//寮�绁�
 		HomeZbjtVo kp = contractInvoiceMapper.homeZbjt();
 		homeZbjtVoList.add(kp);
+		//鍥炴
+		HomeZbjtVo hk = paymentSlipMapper.homeZbjt();
+		homeZbjtVoList.add(hk);
+		//鍚堝悓绛捐 sgb smj jxc tfgs ymj
+		HomeZbjtVo htqd = contractMapper.homeZbjt();
+		homeZbjtVoList.add(htqd);
 		//璧婇攢浜х敓鍊� 浠婂ぉ鍙戣揣鍔犱粖澶╁紑绁ㄩ
 //		if (ObjUtil.isNotNull(ch)&&ObjUtil.isNotNull(kp)){
 //			HomeZbjtVo sxsy = ch.add(kp);
 //			homeZbjtVoList.add(sxsy);
 //		}else if (ObjUtil.isNotNull(ch)&&ObjUtil.isNull(kp)){
-			homeZbjtVoList.add(ch);
+//			homeZbjtVoList.add(ch);
 //		}else if (ObjUtil.isNull(ch)&&ObjUtil.isNotNull(kp)){
 //			homeZbjtVoList.add(kp);
 //		}else {
 //			homeZbjtVoList.add(new HomeZbjtVo());
 //		}
 		//璧婇攢绱鍓╀綑鍊� 浠婃棩鍙戣揣涓旀病寮�绁ㄧ殑鍑鸿揣
-		HomeZbjtVo sx = contractOutBoundMapper.homeZbjtSX();
-		homeZbjtVoList.add(sx);
-		HomeZbjtVo yq = currentOverdueMapper.homeZbjt();
-		//閫炬湡绱鍓╀綑 浠婃棩浜х敓閫炬湡 鍚巻鍙�
-		HomeZbjtVo ls = historyOverdueMapper.homeZbjt();
-		if (ObjUtil.isNotNull(ls)&&ObjUtil.isNotNull(yq)){
-			homeZbjtVoList.add(yq.add(ls));
-		}else if (ObjUtil.isNotNull(ls)&&ObjUtil.isNull(yq)){
-			homeZbjtVoList.add(ls);
-		}else if (ObjUtil.isNull(ls)&&ObjUtil.isNotNull(yq)){
-			homeZbjtVoList.add(yq);
-		}else {
-			homeZbjtVoList.add(new HomeZbjtVo());
-		}
-		//閫炬湡浜х敓鍊� 浠婂ぉ浜х敓-浠婂ぉ宸蹭粯
-
-		homeZbjtVoList.add(yq);
+//		HomeZbjtVo sx = contractOutBoundMapper.homeZbjtSX();
+//		homeZbjtVoList.add(sx);
+//		HomeZbjtVo yq = currentOverdueMapper.homeZbjt();
+//		//閫炬湡绱鍓╀綑 浠婃棩浜х敓閫炬湡 鍚巻鍙�
+//		HomeZbjtVo ls = historyOverdueMapper.homeZbjt();
+//		if (ObjUtil.isNotNull(ls)&&ObjUtil.isNotNull(yq)){
+//			homeZbjtVoList.add(yq.add(ls));
+//		}else if (ObjUtil.isNotNull(ls)&&ObjUtil.isNull(yq)){
+//			homeZbjtVoList.add(ls);
+//		}else if (ObjUtil.isNull(ls)&&ObjUtil.isNotNull(yq)){
+//			homeZbjtVoList.add(yq);
+//		}else {
+//			homeZbjtVoList.add(new HomeZbjtVo());
+//		}
+//		//閫炬湡浜х敓鍊� 浠婂ぉ浜х敓-浠婂ぉ宸蹭粯
+//
+//		homeZbjtVoList.add(yq);
 		return R.ok(homeZbjtVoList);
 	}
 
 	@Override
 	public R homeZgs() {
 		List<HomeZgsVo> homeZbjtVoList = new ArrayList<>();
-		//鍚堝悓绛捐 鍗庡寳  瑗垮寳  涓滃寳  娴峰
-		HomeZgsVo htqd = contractMapper.homeZgs(SecurityUtils.getUser().getCompId());
-		homeZbjtVoList.add(htqd);
-		//鍥炴
-		HomeZgsVo hk = paymentSlipMapper.homeZgs(SecurityUtils.getUser().getCompId());
-		homeZbjtVoList.add(hk);
-		//鍑鸿揣
-		HomeZgsVo ch = contractOutBoundMapper.homeZgs(SecurityUtils.getUser().getCompId());
-		homeZbjtVoList.add(ch);
+
+//		//鍑鸿揣
+//		HomeZgsVo ch = contractOutBoundMapper.homeZgs(SecurityUtils.getUser().getCompId());
+//		homeZbjtVoList.add(ch);
 		//寮�绁�
 		HomeZgsVo kp = contractInvoiceMapper.homeZgs(SecurityUtils.getUser().getCompId());
 		homeZbjtVoList.add(kp);
+		//鍥炴
+		HomeZgsVo hk = paymentSlipMapper.homeZgs(SecurityUtils.getUser().getCompId());
+		homeZbjtVoList.add(hk);
+		//鍚堝悓绛捐 鍗庡寳  瑗垮寳  涓滃寳  娴峰
+		HomeZgsVo htqd = contractMapper.homeZgs(SecurityUtils.getUser().getCompId());
+		homeZbjtVoList.add(htqd);
+
 		//璧婇攢浜х敓鍊�
 //		if (ObjUtil.isNotNull(ch)&&ObjUtil.isNotNull(kp)){
 //			HomeZgsVo sxsy = ch.add(kp);
 //			homeZbjtVoList.add(sxsy);
 //		}else if (ObjUtil.isNotNull(ch)&&ObjUtil.isNull(kp)){
-			homeZbjtVoList.add(ch);
+//			homeZbjtVoList.add(ch);
 //		}else if (ObjUtil.isNull(ch)&&ObjUtil.isNotNull(kp)){
 //			homeZbjtVoList.add(kp);
 //		}else {
 //			homeZbjtVoList.add(new HomeZgsVo());
 //		}
 		//璧婇攢绱鍓╀綑鍊�
-		HomeZgsVo sx = contractOutBoundMapper.homeZgsSX(SecurityUtils.getUser().getCompId());
-		homeZbjtVoList.add(sx);
-
-		HomeZgsVo yq = currentOverdueMapper.homeZgs(SecurityUtils.getUser().getCompId());
-
-		//閫炬湡浜х敓鍊�
-		HomeZgsVo ls = historyOverdueMapper.homeZgs(SecurityUtils.getUser().getCompId());
-		if (ObjUtil.isNotNull(ls)&&ObjUtil.isNotNull(yq)){
-			homeZbjtVoList.add(yq.add(ls));
-		}else if (ObjUtil.isNotNull(ls)&&ObjUtil.isNull(yq)){
-			homeZbjtVoList.add(ls);
-		}else if (ObjUtil.isNull(ls)&&ObjUtil.isNotNull(yq)){
-			homeZbjtVoList.add(yq);
-		}else {
-			homeZbjtVoList.add(new HomeZgsVo());
-		}
-		//閫炬湡绱鍓╀綑
-		homeZbjtVoList.add(yq);
+//		HomeZgsVo sx = contractOutBoundMapper.homeZgsSX(SecurityUtils.getUser().getCompId());
+//		homeZbjtVoList.add(sx);
+//
+//		HomeZgsVo yq = currentOverdueMapper.homeZgs(SecurityUtils.getUser().getCompId());
+//
+//		//閫炬湡浜х敓鍊�
+//		HomeZgsVo ls = historyOverdueMapper.homeZgs(SecurityUtils.getUser().getCompId());
+//		if (ObjUtil.isNotNull(ls)&&ObjUtil.isNotNull(yq)){
+//			homeZbjtVoList.add(yq.add(ls));
+//		}else if (ObjUtil.isNotNull(ls)&&ObjUtil.isNull(yq)){
+//			homeZbjtVoList.add(ls);
+//		}else if (ObjUtil.isNull(ls)&&ObjUtil.isNotNull(yq)){
+//			homeZbjtVoList.add(yq);
+//		}else {
+//			homeZbjtVoList.add(new HomeZgsVo());
+//		}
+//		//閫炬湡绱鍓╀綑
+//		homeZbjtVoList.add(yq);
 		return R.ok(homeZbjtVoList);
 	}
 
@@ -1321,4 +1328,442 @@
 		}
 		return R.ok(homeOverdueVos);
 	}
+
+	@Override
+	public R homeZgsColum() {
+		R<List<SysDictItem>> r = remoteDictService.getDictByType("province");
+		List<SysDictItem> items = r.getData();
+		if (CollUtil.isEmpty(items)){
+			return R.failed("瀹㈠晢鐪佷唤瀛楀吀鍒嗙被鑾峰彇寮傚父");
+		}
+		List<HomeZgsData> list = new ArrayList<>();
+		List<String> contractProvinces = contractMapper.homeZgsColum(SecurityUtils.getUser().getCompId());
+		if (CollUtil.isNotEmpty(contractProvinces)){
+			contractProvinces.stream().forEach(province->{
+				HomeZgsData homeZgsData = contractInvoiceMapper.homeZgsData(SecurityUtils.getUser().getCompId(),province);
+				if (ObjUtil.isNotNull(homeZgsData)) {
+					SysDictItem result = items.stream()
+							.filter(item -> item != null && province.equals(item.getItemValue()))
+							.findFirst()
+							.orElse(null);
+					homeZgsData.setProvinceCode(province);
+					if (ObjUtil.isNotNull(result)) {
+
+						homeZgsData.setProvinceName(result.getLabel());
+					}
+					list.add(homeZgsData);
+				}
+			});
+			return R.ok(list);
+		}
+		return R.ok();
+	}
+
+	@Override
+	public R zbjtStatistic() {
+		List<ZbjtStatisticVo> statisticVoList = new ArrayList<>();
+		String curYear = DateUtil.year(new Date())+"";
+		String curMonth = DateUtil.month(new Date())+"";
+		//鍚堝悓
+		ZbjtStatisticVo htVo = contractMapper.zbjtStatisticByContract();
+		AnnualPlanTotalVo planListHt = annualPlanMapper.selectPlanYear(curYear,"1");
+		if (ObjUtil.isNotNull(htVo)&&ObjUtil.isNotNull(planListHt)){
+			BigDecimal monAmount = planListHt.getMonthAmount(curMonth);
+			if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+				htVo.setBmwc(new BigDecimal(htVo.getBm()).multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+			}
+			BigDecimal yearAmount = planListHt.getTotalAmount();
+			if (ObjUtil.isNotNull(yearAmount)&&yearAmount.compareTo(new BigDecimal("0"))>0){
+				htVo.setBnwc(new BigDecimal(htVo.getBn()).multiply(new BigDecimal("100")).divide(yearAmount,2,RoundingMode.HALF_UP)+"%");
+			}
+		}
+		statisticVoList.add(htVo);
+		//寮�绁�
+		ZbjtStatisticVo kpVo = contractInvoiceMapper.zbjtStatisticByInvoice();
+		AnnualPlanTotalVo planListFP = annualPlanMapper.selectPlanYear(curYear,"2");
+		if (ObjUtil.isNotNull(kpVo)&&ObjUtil.isNotNull(planListFP)){
+			BigDecimal monAmount = planListFP.getMonthAmount(curMonth);
+			if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+				kpVo.setBmwc(new BigDecimal(kpVo.getBm()).multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+			}
+			BigDecimal yearAmount = planListFP.getTotalAmount();
+			if (ObjUtil.isNotNull(yearAmount)&&yearAmount.compareTo(new BigDecimal("0"))>0){
+				kpVo.setBnwc(new BigDecimal(kpVo.getBn()).multiply(new BigDecimal("100")).divide(yearAmount,2,RoundingMode.HALF_UP)+"%");
+			}
+		}
+		statisticVoList.add(kpVo);
+		//鍥炴
+		ZbjtStatisticVo hkVo = paymentSlipMapper.zbjtStatisticByPayment();
+		AnnualPlanTotalVo planListHK = annualPlanMapper.selectPlanYear(curYear,"2");
+		if (ObjUtil.isNotNull(hkVo)&&ObjUtil.isNotNull(planListHK)){
+			BigDecimal monAmount = planListHK.getMonthAmount(curMonth);
+			if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+				hkVo.setBmwc(new BigDecimal(hkVo.getBm()).multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+			}
+			BigDecimal yearAmount = planListHK.getTotalAmount();
+			if (ObjUtil.isNotNull(yearAmount)&&yearAmount.compareTo(new BigDecimal("0"))>0){
+				hkVo.setBnwc(new BigDecimal(hkVo.getBn()).multiply(new BigDecimal("100")).divide(yearAmount,2,RoundingMode.HALF_UP)+"%");
+			}
+		}
+		statisticVoList.add(hkVo);
+		return R.ok(statisticVoList);
+	}
+
+	@Override
+	public R zbjtStatisticContractAmount() {
+		JSONObject jsonObject = new JSONObject();
+		ZbjtStatisticByContractAmountVo hte = contractMapper.zbjtStatisticByContractAmount();
+		jsonObject.put("hte",hte);
+		ZbjtStatisticByContractAmountProVo htp = contractMapper.zbjtStatisticByContractAmountPro();
+		jsonObject.put("cpbk",htp);
+		ZbjtStatisticByContractAmountClassVo sc = contractMapper.zbjtStatisticByContractAmountClass();
+		jsonObject.put("sczb",sc);
+		ZbjtStatisticByContractAmountSupplyVo yw = contractMapper.zbjtStatisticByContractAmountSupply();
+		jsonObject.put("ywzb",yw);
+		ZbjtStatisticByContractAmountClassVo ys = contractMapper.zbjtStatisticByContractAmountYS();
+		jsonObject.put("yszb",ys);
+		return R.ok(jsonObject);
+	}
+
+	@Override
+	public R zbjtIndicatorTrend() {
+		JSONObject jsonObject = new JSONObject();
+		Integer curYear = DateUtil.year(new Date());
+		String startMon = (curYear-3)+"-01-01";
+		String endMon = curYear+"-12-01";
+		List<ZbjtIndicatorTrendVo> trendList = contractMapper.zbjtIndicatorTrend(startMon,endMon);
+		JSONObject zbqs_ht = new JSONObject();
+		zbqs_ht.put((curYear-3)+"",trendList.stream().filter(item->item.getYearMon().startsWith((curYear-3)+"")).collect(Collectors.toList()));
+		zbqs_ht.put((curYear-2)+"",trendList.stream().filter(item->item.getYearMon().startsWith((curYear-2)+"")).collect(Collectors.toList()));
+		zbqs_ht.put((curYear-1)+"",trendList.stream().filter(item->item.getYearMon().startsWith((curYear-1)+"")).collect(Collectors.toList()));
+		zbqs_ht.put(curYear+"",trendList.stream().filter(item->item.getYearMon().startsWith(curYear+"")).collect(Collectors.toList()));
+		jsonObject.put("zbqs-ht",zbqs_ht);
+		List<ZbjtIndicatorTrendVo> trendInvoiceList = contractInvoiceMapper.zbjtIndicatorTrend(startMon,endMon);
+		JSONObject zbqs_sr = new JSONObject();
+		zbqs_sr.put((curYear-3)+"",trendInvoiceList.stream().filter(item->item.getYearMon().startsWith((curYear-3)+"")).collect(Collectors.toList()));
+		zbqs_sr.put((curYear-2)+"",trendInvoiceList.stream().filter(item->item.getYearMon().startsWith((curYear-2)+"")).collect(Collectors.toList()));
+		zbqs_sr.put((curYear-1)+"",trendInvoiceList.stream().filter(item->item.getYearMon().startsWith((curYear-1)+"")).collect(Collectors.toList()));
+		zbqs_sr.put(curYear+"",trendInvoiceList.stream().filter(item->item.getYearMon().startsWith(curYear+"")).collect(Collectors.toList()));
+		jsonObject.put("zbqs-sr",zbqs_sr);
+		List<ZbjtIndicatorTrendVo> trendSlipList = paymentSlipMapper.zbjtIndicatorTrend(startMon,endMon);
+		JSONObject zbqs_hs = new JSONObject();
+		zbqs_hs.put((curYear-3)+"",trendSlipList.stream().filter(item->item.getYearMon().startsWith((curYear-3)+"")).collect(Collectors.toList()));
+		zbqs_hs.put((curYear-2)+"",trendSlipList.stream().filter(item->item.getYearMon().startsWith((curYear-2)+"")).collect(Collectors.toList()));
+		zbqs_hs.put((curYear-1)+"",trendSlipList.stream().filter(item->item.getYearMon().startsWith((curYear-1)+"")).collect(Collectors.toList()));
+		zbqs_hs.put(curYear+"",trendSlipList.stream().filter(item->item.getYearMon().startsWith(curYear+"")).collect(Collectors.toList()));
+		jsonObject.put("zbqs-hk",zbqs_hs);
+		return R.ok(jsonObject);
+	}
+
+	@Override
+	public R zbjtPlanAchieced() {
+		String curYear = DateUtil.year(new Date())+"";
+		JSONObject jsonObject = new JSONObject();
+		JSONObject ht = new JSONObject();
+		AnnualPlanTotalVo planListHt = annualPlanMapper.selectPlanYear(curYear,"1");
+		List<ZbjtIndicatorTrendVo> trendVoList = contractMapper.zbjtPlanAchieced(null);
+		if (ObjUtil.isNotNull(planListHt)&&CollUtil.isNotEmpty(trendVoList)){
+			trendVoList.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListHt.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+		ht.put("zb",trendVoList);
+		List<Long> compIds = new ArrayList<>();
+		compIds.add(2089995177814495234L);
+		compIds.add(2089996921978040321L);
+		compIds.add(2089997578009128962L);
+		compIds.add(2101966257365045249L);
+
+		AnnualPlan planListHtSMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.in(AnnualPlan::getCompId,compIds).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> smjtrendVoList = contractMapper.zbjtPlanAchiecedSmj();
+		if (ObjUtil.isNotNull(planListHtSMJ)&&CollUtil.isNotEmpty(smjtrendVoList)){
+			smjtrendVoList.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListHtSMJ.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+		ht.put("smj",smjtrendVoList);
+		AnnualPlan planListHtSGB = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556196124250113L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> sgbtrendVoList = contractMapper.zbjtPlanAchieced(2056556196124250113L);
+		if (ObjUtil.isNotNull(planListHtSGB)&&CollUtil.isNotEmpty(sgbtrendVoList)){
+			sgbtrendVoList.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListHtSGB.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+		ht.put("sgb",sgbtrendVoList);
+		AnnualPlan planListHTfgs = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556421857497090L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> tfgstrendVoList = contractMapper.zbjtPlanAchieced(2056556421857497090L);
+		if (ObjUtil.isNotNull(planListHTfgs)&&CollUtil.isNotEmpty(tfgstrendVoList)){
+			tfgstrendVoList.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListHTfgs.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+		ht.put("tfgs",tfgstrendVoList);
+		AnnualPlan planListHjxc = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556317461270529L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> jxctrendVoList = contractMapper.zbjtPlanAchieced(2056556317461270529L);
+		if (ObjUtil.isNotNull(planListHjxc)&&CollUtil.isNotEmpty(jxctrendVoList)){
+			jxctrendVoList.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListHjxc.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+
+		ht.put("jxc",jxctrendVoList);
+		AnnualPlan planListHYMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556535640576002L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> ymjtrendVoList = contractMapper.zbjtPlanAchieced(2056556535640576002L);
+		if (ObjUtil.isNotNull(planListHYMJ)&&CollUtil.isNotEmpty(ymjtrendVoList)){
+			ymjtrendVoList.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListHYMJ.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+
+		ht.put("ymj",ymjtrendVoList);
+		jsonObject.put("ht",ht);
+		JSONObject sr = new JSONObject();
+		AnnualPlanTotalVo planLisSR = annualPlanMapper.selectPlanYear(curYear,"1");
+		List<ZbjtIndicatorTrendVo> trendVoList1 = contractInvoiceMapper.zbjtPlanAchieced(null);
+		if (ObjUtil.isNotNull(planLisSR)&&CollUtil.isNotEmpty(trendVoList1)){
+			trendVoList1.stream().forEach(trendVo->{
+				BigDecimal monAmount = planLisSR.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+		sr.put("zb",trendVoList1);
+
+		AnnualPlan planListSRSMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"2")
+				.in(AnnualPlan::getCompId,compIds).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> smjtrendVoList1 = contractInvoiceMapper.zbjtPlanAchiecedSmj();
+		if (ObjUtil.isNotNull(planListSRSMJ)&&CollUtil.isNotEmpty(smjtrendVoList1)){
+			smjtrendVoList1.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListSRSMJ.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+
+		sr.put("smj",smjtrendVoList1);
+		//鐭冲伐娉垫敹鍏�
+		AnnualPlan planListSRSGB = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556196124250113L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> sgbtrendVoList1 = contractInvoiceMapper.zbjtPlanAchieced(2056556196124250113L);
+		if (ObjUtil.isNotNull(planListSRSGB)&&CollUtil.isNotEmpty(sgbtrendVoList1)){
+			sgbtrendVoList1.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListSRSGB.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+
+		sr.put("sgb",sgbtrendVoList1);
+		//閫氭柟鍏徃鏀跺叆
+		AnnualPlan planListSRTFGS = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556421857497090L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> tfgstrendVoList1 = contractInvoiceMapper.zbjtPlanAchieced(2056556421857497090L);
+
+		if (ObjUtil.isNotNull(planListSRTFGS)&&CollUtil.isNotEmpty(tfgstrendVoList1)){
+			tfgstrendVoList1.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListSRTFGS.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+		sr.put("tfgs",tfgstrendVoList1);
+		//鏈烘鍘傛敹鍏�
+		AnnualPlan planListSRJXC = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556317461270529L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> jxctrendVoList1 = contractInvoiceMapper.zbjtPlanAchieced(2056556317461270529L);
+
+
+		if (ObjUtil.isNotNull(planListSRJXC)&&CollUtil.isNotEmpty(jxctrendVoList1)){
+			jxctrendVoList1.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListSRJXC.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+		sr.put("jxc",jxctrendVoList1);
+		//涓�鐓ゆ満鏀跺叆
+		AnnualPlan planListSRYMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556317461270529L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> ymjtrendVoList1 = contractInvoiceMapper.zbjtPlanAchieced(2056556535640576002L);
+
+
+		if (ObjUtil.isNotNull(planListSRYMJ)&&CollUtil.isNotEmpty(ymjtrendVoList1)){
+			ymjtrendVoList1.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListSRYMJ.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+		sr.put("ymj",ymjtrendVoList1);
+		jsonObject.put("sr",sr);
+
+		JSONObject hk = new JSONObject();
+		//鍥炴
+		AnnualPlanTotalVo planLisHK = annualPlanMapper.selectPlanYear(curYear,"1");
+		List<ZbjtIndicatorTrendVo> trendVoList2 = paymentSlipMapper.zbjtPlanAchieced(null);
+		if (ObjUtil.isNotNull(planLisHK)&&CollUtil.isNotEmpty(trendVoList2)){
+			trendVoList2.stream().forEach(trendVo->{
+				BigDecimal monAmount = planLisHK.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+		hk.put("zb",trendVoList2);
+		//鐭崇叅鏈哄洖娆�
+		AnnualPlan planListHKSMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"2")
+				.in(AnnualPlan::getCompId,compIds).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> smjtrendVoList2 = paymentSlipMapper.zbjtPlanAchiecedSmj();
+		if (ObjUtil.isNotNull(planListHKSMJ)&&CollUtil.isNotEmpty(smjtrendVoList2)){
+			smjtrendVoList2.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListHKSMJ.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+
+		hk.put("smj",smjtrendVoList2);
+		//鐭冲伐娉靛洖娆�
+		AnnualPlan planListHKSGB = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556196124250113L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> sgbtrendVoList2 = paymentSlipMapper.zbjtPlanAchieced(2056556196124250113L);
+
+
+		if (ObjUtil.isNotNull(planListHKSGB)&&CollUtil.isNotEmpty(sgbtrendVoList2)){
+			sgbtrendVoList2.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListHKSGB.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+
+		hk.put("sgb",sgbtrendVoList2);
+		//tfgs鍥炴
+		AnnualPlan planListHKTFGS = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556421857497090L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> tfgstrendVoList2 = paymentSlipMapper.zbjtPlanAchieced(2056556421857497090L);
+
+		if (ObjUtil.isNotNull(planListHKTFGS)&&CollUtil.isNotEmpty(tfgstrendVoList2)){
+			tfgstrendVoList2.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListHKTFGS.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+
+		hk.put("tfgs",tfgstrendVoList2);
+		//鏈烘鍘傚洖娆�
+		AnnualPlan planListHKJXC = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556317461270529L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> jxctrendVoList2 = paymentSlipMapper.zbjtPlanAchieced(2056556317461270529L);
+
+		if (ObjUtil.isNotNull(planListHKJXC)&&CollUtil.isNotEmpty(jxctrendVoList2)){
+			jxctrendVoList2.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListHKJXC.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+
+
+		hk.put("jxc",jxctrendVoList2);
+		//涓�鐓ゆ満鍥炴
+		AnnualPlan planListHKYMJ = annualPlanMapper.selectOne(Wrappers.<AnnualPlan>lambdaQuery()
+				.eq(AnnualPlan::getPlanYear,curYear).eq(AnnualPlan::getPlanType,"1")
+				.eq(AnnualPlan::getCompId,2056556535640576002L).last("limit 1"));
+		List<ZbjtIndicatorTrendVo> ymjtrendVoList2 = paymentSlipMapper.zbjtPlanAchieced(2056556535640576002L);
+
+		if (ObjUtil.isNotNull(planListHKYMJ)&&CollUtil.isNotEmpty(ymjtrendVoList2)){
+			ymjtrendVoList2.stream().forEach(trendVo->{
+				BigDecimal monAmount = planListHKYMJ.getMonthAmount(trendVo.getYearMon());
+				if (ObjUtil.isNotNull(monAmount)&&monAmount.compareTo(new BigDecimal("0"))>0){
+					trendVo.setWc(trendVo.getJe().multiply(new BigDecimal("100")).divide(monAmount,2,RoundingMode.HALF_UP)+"%");
+				}
+			});
+		}
+
+		hk.put("ymj",ymjtrendVoList2);
+		jsonObject.put("hk",hk);
+		return R.ok(jsonObject);
+	}
+
+	@Override
+	public R zbjtReceiveScale() {
+
+		JSONObject hk = new JSONObject();
+		//鍥炴
+		List<ZbjtIndicatorTrendVo> trendVoList = paymentReceiveMapper.zbjtReceiveScale(null);
+		hk.put("zb",trendVoList);
+		//鐭崇叅鏈哄洖娆�
+
+		List<Long> compIds = new ArrayList<>();
+		compIds.add(2089995177814495234L);
+		compIds.add(2089996921978040321L);
+		compIds.add(2089997578009128962L);
+		compIds.add(2101966257365045249L);
+
+		List<ZbjtIndicatorTrendVo> trendVoListSMJ = paymentReceiveMapper.zbjtReceiveScaleSMJ();
+		hk.put("smj",trendVoListSMJ);
+		//鐭冲伐娉靛洖娆�
+		List<ZbjtIndicatorTrendVo> trendVoListSGB = paymentReceiveMapper.zbjtReceiveScale(2056556196124250113L);
+
+		hk.put("sgb",trendVoListSGB);
+		//tfgs
+		List<ZbjtIndicatorTrendVo> trendVoListTFGS = paymentReceiveMapper.zbjtReceiveScale(2056556421857497090L);
+		hk.put("tfgs",trendVoListTFGS);
+		//鏈烘鍘傚洖娆�
+		List<ZbjtIndicatorTrendVo> trendVoListJXC = paymentReceiveMapper.zbjtReceiveScale(2056556317461270529L);
+		hk.put("jxc",trendVoListJXC);
+		//涓�鐓ゆ満鍥炴
+		List<ZbjtIndicatorTrendVo> trendVoListYMJ = paymentReceiveMapper.zbjtReceiveScale(2056556535640576002L);
+		hk.put("ymj",trendVoListYMJ);
+		return R.ok(hk);
+	}
 }

--
Gitblit v1.9.1