|
|
@@ -2,6 +2,7 @@ package com.siwei.apply.service.cadastre.impl;
|
|
|
|
|
|
import com.siwei.apply.domain.YdbpData;
|
|
|
import com.siwei.apply.domain.res.*;
|
|
|
+import com.siwei.apply.domain.vo.BatchTrendReportVO;
|
|
|
import com.siwei.apply.domain.vo.LandSupplyProjectVO;
|
|
|
import com.siwei.apply.mapper.*;
|
|
|
import com.siwei.common.core.exception.ServiceException;
|
|
|
@@ -103,6 +104,124 @@ public class BatchServiceImpl{
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public BatchTrendReportVO trendReport(String startYear, String endYear) {
|
|
|
+ if(StringUtils.isBlank(startYear)||StringUtils.isBlank(endYear)){
|
|
|
+ throw new ServiceException("年份不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ BatchTrendReportVO batchTrendReportVO = new BatchTrendReportVO();
|
|
|
+ List<BatchTrendReportVO.RowData> rows = new ArrayList<>();
|
|
|
+
|
|
|
+ List<Map<String,Object>> singleBatchList = ydbpMapper.getStatisticsList(startYear,"",false);
|
|
|
+ List<YdbpData> reportBatchList = ydbpDataMapper.getStatisticsList(startYear,"",false);
|
|
|
+
|
|
|
+ Map<String,List<Map<String,Object>>> groupedSingleBatch = new HashMap<>();
|
|
|
+ Map<String, List<YdbpData>> groupedReportBatch = new HashMap<>();
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(singleBatchList)) {
|
|
|
+ groupedSingleBatch = singleBatchList.stream()
|
|
|
+ .collect(Collectors.groupingBy(s->{
|
|
|
+ Object nfStr = s.get("nf");
|
|
|
+ if(nfStr==null || String.valueOf(nfStr).isEmpty()||"1000".equals(String.valueOf(nfStr))){
|
|
|
+ return "其它";
|
|
|
+ }
|
|
|
+ return String.valueOf(nfStr);
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(reportBatchList)) {
|
|
|
+ groupedReportBatch = reportBatchList.stream()
|
|
|
+ .collect(Collectors.groupingBy(s->{
|
|
|
+ String pfDate = s.getPfDate();
|
|
|
+ if(StringUtils.isBlank(pfDate)){
|
|
|
+ return "其它";
|
|
|
+ }
|
|
|
+ pfDate = StringUtils.substring(pfDate,0,4);
|
|
|
+ return pfDate;
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+ Set<String> yearSet = new LinkedHashSet<>();
|
|
|
+ if(MapUtils.isNotEmpty(groupedSingleBatch)) {
|
|
|
+ yearSet.addAll(groupedSingleBatch.keySet());
|
|
|
+ }
|
|
|
+ if(MapUtils.isNotEmpty(groupedReportBatch)) {
|
|
|
+ yearSet.addAll(groupedReportBatch.keySet());
|
|
|
+ }
|
|
|
+
|
|
|
+ for(String yearKey : yearSet){
|
|
|
+ List<Map<String,Object>> singleList = groupedSingleBatch.get(yearKey);
|
|
|
+ List<YdbpData> reportList = groupedReportBatch.get(yearKey);
|
|
|
+
|
|
|
+ //计算单独选址的value
|
|
|
+ Double singleArea = sumAreaForSingle(singleList);
|
|
|
+ Integer singleCount = singleList==null?0:singleList.size();
|
|
|
+ BatchTrendReportVO.TrendData singleTrendData = new BatchTrendReportVO.TrendData();
|
|
|
+ singleTrendData.setArea(singleArea);
|
|
|
+ singleTrendData.setCount(singleCount);
|
|
|
+
|
|
|
+ //计算报批项目的value
|
|
|
+ Double reportArea = sumArea(reportList);
|
|
|
+ Integer reportCount = reportList==null?0:reportList.size();
|
|
|
+ BatchTrendReportVO.TrendData reportTrendData = new BatchTrendReportVO.TrendData();
|
|
|
+ reportTrendData.setArea(reportArea);
|
|
|
+ reportTrendData.setCount(reportCount);
|
|
|
+
|
|
|
+ //计算总量
|
|
|
+ BatchTrendReportVO.TrendData totalTrendData = new BatchTrendReportVO.TrendData();
|
|
|
+ totalTrendData.setCount(singleCount+reportCount);
|
|
|
+ totalTrendData.setArea(singleArea+reportArea);
|
|
|
+
|
|
|
+ //这里组装row
|
|
|
+ BatchTrendReportVO.RowData rowData = new BatchTrendReportVO.RowData();
|
|
|
+ rowData.setYear(yearKey);//设置名称
|
|
|
+ rowData.setSignleData(singleTrendData);
|
|
|
+ rowData.setReportData(reportTrendData);
|
|
|
+ rowData.setTotalData(totalTrendData);
|
|
|
+
|
|
|
+ rows.add(rowData);
|
|
|
+ }
|
|
|
+ batchTrendReportVO.setRows(rows);
|
|
|
+
|
|
|
+ //这里计算合计行
|
|
|
+ BatchTrendReportVO.RowData total = new BatchTrendReportVO.RowData();
|
|
|
+ {
|
|
|
+ String year = "合计";
|
|
|
+
|
|
|
+ //计算单独选址的value
|
|
|
+ Double singleArea = sumAreaForSingle(singleBatchList);
|
|
|
+ Integer singleCount = singleBatchList==null?0:singleBatchList.size();
|
|
|
+ BatchTrendReportVO.TrendData singleTrendData = new BatchTrendReportVO.TrendData();
|
|
|
+ singleTrendData.setArea(singleArea);
|
|
|
+ singleTrendData.setCount(singleCount);
|
|
|
+
|
|
|
+ //计算报批项目的value
|
|
|
+ Double reportArea = sumArea(reportBatchList);
|
|
|
+ Integer reportCount = reportBatchList==null?0:reportBatchList.size();
|
|
|
+ BatchTrendReportVO.TrendData reportTrendData = new BatchTrendReportVO.TrendData();
|
|
|
+ reportTrendData.setArea(reportArea);
|
|
|
+ reportTrendData.setCount(reportCount);
|
|
|
+
|
|
|
+ //计算总量
|
|
|
+ BatchTrendReportVO.TrendData totalTrendData = new BatchTrendReportVO.TrendData();
|
|
|
+ totalTrendData.setCount(singleCount+reportCount);
|
|
|
+ totalTrendData.setArea(singleArea+reportArea);
|
|
|
+
|
|
|
+ //这里组装row
|
|
|
+ total.setYear(year);//设置名称
|
|
|
+ total.setSignleData(singleTrendData);
|
|
|
+ total.setReportData(reportTrendData);
|
|
|
+ total.setTotalData(totalTrendData);
|
|
|
+ }
|
|
|
+
|
|
|
+ batchTrendReportVO.setTotal(total);
|
|
|
+ return batchTrendReportVO;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public List<YdbpData> billProjectList(String year) {
|
|
|
if(StringUtils.isBlank(year)){
|
|
|
throw new ServiceException("年份不能为空");
|
|
|
@@ -134,13 +253,78 @@ public class BatchServiceImpl{
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public List<Map<String,Object>> approvalAndNotSupply(String year) {
|
|
|
+ if (StringUtils.isBlank(year) || "0".equals(year)) {
|
|
|
+ year = "";
|
|
|
+ }
|
|
|
|
|
|
+ List<Map<String,Object>> resList = new ArrayList<>();
|
|
|
+ List<Map<String,Object>> singleBatchList = new ArrayList<>();
|
|
|
+ List<Map<String,Object>> reportBatchList = ydbpDataMapper.queryRemainGeomAreaByYear();
|
|
|
|
|
|
- /**
|
|
|
- * 年度统计
|
|
|
- * @param year
|
|
|
- * @return
|
|
|
- */
|
|
|
+ Map<String,List<Map<String,Object>>> groupedSingleBatch = new HashMap<>();
|
|
|
+ Map<String, List<YdbpData>> groupedReportBatch = new HashMap<>();
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(singleBatchList)) {
|
|
|
+ groupedSingleBatch = singleBatchList.stream()
|
|
|
+ .collect(Collectors.groupingBy(s->{
|
|
|
+ Object nfStr = s.get("stat_year");
|
|
|
+ if(nfStr==null || String.valueOf(nfStr).isEmpty()||"1000".equals(String.valueOf(nfStr))){
|
|
|
+ return "其它";
|
|
|
+ }
|
|
|
+ return String.valueOf(nfStr);
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(reportBatchList)) {
|
|
|
+// groupedReportBatch = reportBatchList.stream()
|
|
|
+// .collect(Collectors.groupingBy(s->{
|
|
|
+// String pfDate = "";
|
|
|
+// if(StringUtils.isBlank(pfDate)){
|
|
|
+// return "其它";
|
|
|
+// }
|
|
|
+// pfDate = StringUtils.substring(pfDate,0,4);
|
|
|
+// return pfDate;
|
|
|
+// }));
|
|
|
+ }
|
|
|
+
|
|
|
+ Set<String> yearSet = new LinkedHashSet<>();
|
|
|
+ if(MapUtils.isNotEmpty(groupedSingleBatch)) {
|
|
|
+ yearSet.addAll(groupedSingleBatch.keySet());
|
|
|
+ }
|
|
|
+ if(MapUtils.isNotEmpty(groupedReportBatch)) {
|
|
|
+ yearSet.addAll(groupedReportBatch.keySet());
|
|
|
+ }
|
|
|
+
|
|
|
+ for(String yearKey : yearSet){
|
|
|
+ Double areaArea = 0d;
|
|
|
+ if(groupedSingleBatch.containsKey(yearKey)){
|
|
|
+ //Map<Object>ddd = groupedSingleBatch.get(yearKey);
|
|
|
+// areaArea += groupedSingleBatch.get("ddd");
|
|
|
+ }
|
|
|
+ Map<String,Object> itemMap = new HashMap<>();
|
|
|
+ itemMap.put("year",yearKey);
|
|
|
+ itemMap.put("singleArea",null);
|
|
|
+ itemMap.put("reportArea",null);
|
|
|
+ resList.add(itemMap);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 年度统计
|
|
|
+ * @param year
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public List<Map<String,Object>> trendStatistics(String year) {
|
|
|
if (StringUtils.isBlank(year) || "0".equals(year)) {
|
|
|
year = "";
|
|
|
@@ -206,6 +390,7 @@ public class BatchServiceImpl{
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 年度统计
|
|
|
* @param year
|