|
|
@@ -2,17 +2,18 @@ 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.mapper.*;
|
|
|
+import com.siwei.common.core.exception.ServiceException;
|
|
|
import com.siwei.common.core.utils.StringUtils;
|
|
|
-import com.siwei.spatial.api.RemoteSpatialFilesDbService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
@@ -20,41 +21,519 @@ import java.util.*;
|
|
|
public class BatchServiceImpl{
|
|
|
|
|
|
@Autowired
|
|
|
- private GongdiJihuaMapper gongdiJihuaMapper;
|
|
|
+ private YdbpMapper ydbpMapper;
|
|
|
|
|
|
@Autowired
|
|
|
- private TdgyMapper dgyMapper;
|
|
|
+ private YdbpDataMapper ydbpDataMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
- private LandTypeMapper landTypeMapper;
|
|
|
+ public List<?> getNotSupplyList(String year) {
|
|
|
+ List<Map<String, Object>> resList = new ArrayList<>();
|
|
|
+ String param = year;
|
|
|
+ if(StringUtils.isBlank(year)||"0".equals(year)||"1000".equals(year)||"2016年前".equals(year)){
|
|
|
+ param ="";
|
|
|
+ }
|
|
|
+ List<Map<String,Object>> ydbpNotSupplyList = ydbpMapper.queryRemainGeomListByYearOfYdbp(param);
|
|
|
+ List<Map<String,Object>> ydbpDataNotSupplyList = ydbpDataMapper.queryDifferenceGeomAreaByYear(param);
|
|
|
|
|
|
- @Autowired
|
|
|
- private RemoteSpatialFilesDbService remoteSpatialFilesDbService;
|
|
|
+ if(CollectionUtils.isNotEmpty(ydbpNotSupplyList)){
|
|
|
+ resList.addAll(ydbpNotSupplyList);
|
|
|
+ }
|
|
|
+ if(CollectionUtils.isNotEmpty(ydbpDataNotSupplyList)){
|
|
|
+ resList.addAll(ydbpDataNotSupplyList);
|
|
|
+ }
|
|
|
|
|
|
- @Autowired
|
|
|
- private YdbpMapper ydbpMapper;
|
|
|
+ //条件过滤兼容特使情况
|
|
|
+ if("1000".equals(year)){
|
|
|
+ resList = resList.stream().filter(
|
|
|
+ s->"其它".equals(s.get("year")) || "其它".equals(s.get("nf")) || "1000".equals(s.get("nf"))).collect(Collectors.toList());
|
|
|
+ }else if("2016年前".equals(year)) {
|
|
|
+ resList = resList.stream().filter(s -> {
|
|
|
+ String yearString = Objects.nonNull(s.get("year"))? s.get("year").toString(): "";
|
|
|
+ String nf = Objects.nonNull(s.get("nf"))? s.get("nf").toString(): "";
|
|
|
+ if (StringUtils.isNumeric(yearString) && Integer.parseInt(yearString) > 1000 && Integer.parseInt(yearString) < 2016) {
|
|
|
+ return true;
|
|
|
+ } else if (StringUtils.isNumeric(nf) && Integer.parseInt(nf)>1000 && Integer.parseInt(nf) < 2016) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ return resList;
|
|
|
+ }
|
|
|
|
|
|
- @Autowired
|
|
|
- private YdbpDataMapper ydbpDataMapper;
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * batchType (1-单批次项目,2-报批项目,0-全部)
|
|
|
+ * 获取项目列表
|
|
|
+ * @param year
|
|
|
+ * @param batchType
|
|
|
+ * @param keyWord
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<?> projectList(String year, Integer batchType, String keyWord) {
|
|
|
+ List<Object> resList = new ArrayList<>();
|
|
|
+ if (batchType == 1) {
|
|
|
+ return buildSingleProjectList(year, keyWord);
|
|
|
+ } else if (batchType == 2) {
|
|
|
+ return buildReportProjectList(year, keyWord);
|
|
|
+ } else if (batchType == 0) {
|
|
|
+ resList.addAll(buildSingleProjectList(year, keyWord));
|
|
|
+ resList.addAll(buildReportProjectList(year, keyWord));
|
|
|
+ }
|
|
|
+ return resList;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ private List<Map<String,Object>> buildSingleProjectList(String year, String keyWord) {
|
|
|
+ List<Map<String,Object>> singleBatchList = ydbpMapper.getStatisticsList(year,keyWord,"","",true);
|
|
|
+ if (CollectionUtils.isEmpty(singleBatchList)) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ singleBatchList.forEach(item -> {
|
|
|
+ item.put("projectPropertyId",item.get("project_id") == null ? "" : String.valueOf(item.get("project_id")));
|
|
|
+ item.put("batchType",item.get("batch_type") == null ? "" : String.valueOf(item.get("batch_type")));
|
|
|
+ Double mj_mu = (Double) item.get("mj_mu");
|
|
|
+ item.put("mj_mu",String.format("%.2f", mj_mu == null ? 0d : mj_mu));
|
|
|
+ });
|
|
|
+ return singleBatchList;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<YdbpData> buildReportProjectList(String year, String keyWord) {
|
|
|
+ List<YdbpData> reportBatchList = ydbpDataMapper.getStatisticsList(year,keyWord,"","",true);
|
|
|
+ if (CollectionUtils.isEmpty(reportBatchList)) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ reportBatchList.forEach(item -> {
|
|
|
+ item.setProjectPropertyId(item.getId());
|
|
|
+ item.setZsArea(Float.valueOf(String.format("%.2f", item.getZsArea() == null ? 0f : item.getZsArea())));
|
|
|
+ });
|
|
|
+ return reportBatchList;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
- * 年度统计
|
|
|
- * @param year
|
|
|
+ *
|
|
|
+ * 获取报批项目详情
|
|
|
+ * @param propertyId
|
|
|
* @return
|
|
|
*/
|
|
|
- public BatchRateRes trendStatistics(String year) {
|
|
|
+ public YdbpData getReportProject(String propertyId) {
|
|
|
+ return ydbpDataMapper.getById(propertyId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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,endYear,"",false);
|
|
|
+ List<YdbpData> reportBatchList = ydbpDataMapper.getStatisticsList("",startYear,endYear,"",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 TreeSet<>();
|
|
|
+ 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("年份不能为空");
|
|
|
+ }
|
|
|
+ List<YdbpData> resList = new ArrayList<>();
|
|
|
+ List<YdbpData> reportBatchList = ydbpDataMapper.getStatisticsList(year,"","","",false);
|
|
|
+ if(CollectionUtils.isNotEmpty(reportBatchList)){
|
|
|
+ resList.addAll(reportBatchList);
|
|
|
+ }
|
|
|
+ List<Map<String,Object>> singleBatchList = ydbpMapper.getStatisticsList(year,"","","",false);
|
|
|
+ if(CollectionUtils.isNotEmpty(singleBatchList)){
|
|
|
+ singleBatchList.stream().map(s->{
|
|
|
+ YdbpData ydbpData = new YdbpData();
|
|
|
+ ydbpData.setId(s.get("id")+"");
|
|
|
+ ydbpData.setProjectPropertyId(s.get("project_id") == null ? "" : String.valueOf(s.get("project_id")));
|
|
|
+ ydbpData.setName(s.get("project_name")+"");
|
|
|
+ ydbpData.setBatchType(s.get("batch_type")+"");
|
|
|
+ ydbpData.setYdArea(s.get("yd_area") == null ? 0f : Float.parseFloat(String.valueOf(s.get("yd_area"))));
|
|
|
+ ydbpData.setZsArea(s.get("mj_mu") == null ? 0f : Float.parseFloat(String.valueOf(s.get("mj_mu"))));
|
|
|
+ ydbpData.setYdUnit(s.get("yd_unit")+"");
|
|
|
+ ydbpData.setYdUnit(s.get("zs_unit")+"");
|
|
|
+ ydbpData.setBpDate(s.get("bp_date")+"");
|
|
|
+ ydbpData.setPfDate(s.get("pf_date")+"");
|
|
|
+ ydbpData.setPfwh(s.get("pfwh")+"");
|
|
|
+ return ydbpData;
|
|
|
+ }).forEach(resList::add);
|
|
|
+ }
|
|
|
+ return resList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public List<Map<String,Object>> approvalAndNotSupply(String year) {
|
|
|
if (StringUtils.isBlank(year) || "0".equals(year)) {
|
|
|
year = "";
|
|
|
}
|
|
|
- BatchRateRes res = new BatchRateRes();
|
|
|
- return null;
|
|
|
+
|
|
|
+ List<Map<String,Object>> resList = new ArrayList<>();
|
|
|
+ List<Map<String,Object>> singleBatchList = ydbpMapper.queryRemainGeomAreaByYearOfYdbp();
|
|
|
+ List<Map<String,Object>> reportBatchList = ydbpDataMapper.queryDifferenceGeomAreaByYear("");
|
|
|
+
|
|
|
+ Map<String,Map<String,Object>> groupedSingleBatch = new HashMap<>();
|
|
|
+ Map<String,Map<String,Object>> groupedReportBatch = new HashMap<>();
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(singleBatchList)) {
|
|
|
+ groupedSingleBatch = singleBatchList.stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ s -> {
|
|
|
+ Object nfStr = s.get("stat_year");
|
|
|
+ if(nfStr==null || String.valueOf(nfStr).isEmpty()||"1000".equals(String.valueOf(nfStr))){
|
|
|
+ return "其它";
|
|
|
+ }
|
|
|
+ return String.valueOf(nfStr);
|
|
|
+ },
|
|
|
+ s -> s // value直接是当前对象
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(reportBatchList)) {
|
|
|
+ groupedReportBatch = reportBatchList.stream()
|
|
|
+ .collect(Collectors.toMap(s->{
|
|
|
+ Object nfStr = s.get("nf");
|
|
|
+ if(nfStr==null || String.valueOf(nfStr).isEmpty()||"1000".equals(String.valueOf(nfStr))){
|
|
|
+ return "其它";
|
|
|
+ }
|
|
|
+ return String.valueOf(nfStr);
|
|
|
+ },
|
|
|
+ s->s));
|
|
|
+ }
|
|
|
+
|
|
|
+ Set<String> yearSet = new TreeSet<>();
|
|
|
+ if(MapUtils.isNotEmpty(groupedSingleBatch)) {
|
|
|
+ yearSet.addAll(groupedSingleBatch.keySet());
|
|
|
+ }
|
|
|
+ if(MapUtils.isNotEmpty(groupedReportBatch)) {
|
|
|
+ yearSet.addAll(groupedReportBatch.keySet());
|
|
|
+ }
|
|
|
+
|
|
|
+ for(String yearKey : yearSet){
|
|
|
+ Map<String,Object> single = groupedSingleBatch.get(yearKey);
|
|
|
+ Map<String,Object> report = groupedReportBatch.get(yearKey);
|
|
|
+
|
|
|
+ Double singleArea = Objects.nonNull(single) ? (Double)single.get("total_area_mu"):0d;
|
|
|
+ Double reportArea = Objects.nonNull(report) ? (Double) report.get("rest_area"):0d;
|
|
|
+
|
|
|
+ Long singleCount = Objects.nonNull(single) ? (Long) single.get("patch_count"):0;
|
|
|
+ Long reportCount = 0L;
|
|
|
+
|
|
|
+ Map<String,Object> itemMap = new HashMap<>();
|
|
|
+ itemMap.put("year",yearKey);
|
|
|
+ itemMap.put("area",String.format("%.2f", (singleArea+reportArea)));
|
|
|
+ itemMap.put("count",singleCount+reportCount);
|
|
|
+ resList.add(itemMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(resList)) {
|
|
|
+ int tmpYear = 2015;
|
|
|
+ double tmpArea = 0d;
|
|
|
+ List<Map<String,Object>> newResList = new ArrayList<>();
|
|
|
+ for(Map<String,Object> map : resList) {
|
|
|
+ String theYear = String.valueOf(map.get("year"));
|
|
|
+ if (StringUtils.isNumeric(theYear) && Integer.parseInt(theYear) <= tmpYear) {
|
|
|
+ tmpArea += Double.parseDouble(String.valueOf(map.get("area")));
|
|
|
+ }else {
|
|
|
+ newResList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 这里增加到list中
|
|
|
+ Map<String,Object> itemMap = new HashMap<>();
|
|
|
+ itemMap.put("year","2016年前");
|
|
|
+ itemMap.put("area",String.format("%.2f", tmpArea));
|
|
|
+ itemMap.put("count",0);
|
|
|
+ newResList.add(itemMap);
|
|
|
+ resList = newResList;
|
|
|
+ }
|
|
|
+ return resList;
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ public List<Map<String,Object>> approvalAndNotSupply_delete(String year) {
|
|
|
+ if (StringUtils.isBlank(year) || "0".equals(year)) {
|
|
|
+ year = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String,Object>> resList = new ArrayList<>();
|
|
|
+
|
|
|
+ List<Map<String,Object>> singleBatchList = ydbpMapper.queryRemainGeomAreaByYearOfYdbp();
|
|
|
+ List<Map<String,Object>> reportBatchList = ydbpDataMapper.queryRemainGeomAreaByYear();
|
|
|
+
|
|
|
+ Map<String,Map<String,Object>> groupedSingleBatch = new HashMap<>();
|
|
|
+ Map<String,Map<String,Object>> groupedReportBatch = new HashMap<>();
|
|
|
+
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(singleBatchList)) {
|
|
|
+ groupedSingleBatch = singleBatchList.stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ s -> {
|
|
|
+ Object nfStr = s.get("stat_year");
|
|
|
+ if(nfStr==null || String.valueOf(nfStr).isEmpty()||"1000".equals(String.valueOf(nfStr))){
|
|
|
+ return "其它";
|
|
|
+ }
|
|
|
+ return String.valueOf(nfStr);
|
|
|
+ },
|
|
|
+ s -> s // value直接是当前对象
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(reportBatchList)) {
|
|
|
+ groupedReportBatch = reportBatchList.stream()
|
|
|
+ .collect(Collectors.toMap(s->{
|
|
|
+ Object nfStr = s.get("stat_year");
|
|
|
+ if(nfStr==null || String.valueOf(nfStr).isEmpty()||"1000".equals(String.valueOf(nfStr))){
|
|
|
+ return "其它";
|
|
|
+ }
|
|
|
+ return String.valueOf(nfStr);
|
|
|
+ },
|
|
|
+ s->s));
|
|
|
+ }
|
|
|
+
|
|
|
+ Set<String> yearSet = new TreeSet<>();
|
|
|
+ if(MapUtils.isNotEmpty(groupedSingleBatch)) {
|
|
|
+ yearSet.addAll(groupedSingleBatch.keySet());
|
|
|
+ }
|
|
|
+ if(MapUtils.isNotEmpty(groupedReportBatch)) {
|
|
|
+ yearSet.addAll(groupedReportBatch.keySet());
|
|
|
+ }
|
|
|
+
|
|
|
+ for(String yearKey : yearSet){
|
|
|
+ Map<String,Object> single = groupedSingleBatch.get(yearKey);
|
|
|
+ Map<String,Object> report = groupedReportBatch.get(yearKey);
|
|
|
+
|
|
|
+ Double singleArea = Objects.nonNull(single) ? (Double)single.get("total_area_mu"):0d;
|
|
|
+ Double reportArea = Objects.nonNull(report) ? (Double) report.get("total_area_mu"):0d;
|
|
|
+
|
|
|
+ Long singleCount = Objects.nonNull(single) ? (Long) single.get("patch_count"):0;
|
|
|
+ Long reportCount = Objects.nonNull(report) ? (Long) report.get("patch_count"):0;
|
|
|
+
|
|
|
+ Map<String,Object> itemMap = new HashMap<>();
|
|
|
+ itemMap.put("year",yearKey);
|
|
|
+ itemMap.put("area",String.format("%.2f", (singleArea+reportArea)));
|
|
|
+ itemMap.put("count",singleCount+reportCount);
|
|
|
+
|
|
|
+ resList.add(itemMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ return resList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 年度统计
|
|
|
+ * @param year
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Map<String,Object>> trendStatistics(String year) {
|
|
|
+ if (StringUtils.isBlank(year) || "0".equals(year)) {
|
|
|
+ year = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String,Object>> resList = new ArrayList<>();
|
|
|
+ List<Map<String,Object>> singleBatchList = ydbpMapper.getStatisticsList(year,"","","",false);
|
|
|
+ List<YdbpData> reportBatchList = ydbpDataMapper.getStatisticsList(year,"","","",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 TreeSet<>();
|
|
|
+ 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);
|
|
|
+ Double singleArea = sumAreaForSingle(singleList);
|
|
|
+ Double reportArea = sumArea(reportList);
|
|
|
+ Integer singleCount = singleList==null?0:singleList.size();
|
|
|
+ Integer reportCount = reportList==null?0:reportList.size();
|
|
|
+ Map<String,Object> itemMap = new HashMap<>();
|
|
|
+ itemMap.put("year",yearKey);
|
|
|
+ itemMap.put("singleArea",singleArea);
|
|
|
+ itemMap.put("reportArea",reportArea);
|
|
|
+ itemMap.put("singleCount",singleCount);
|
|
|
+ itemMap.put("reportCount",reportCount);
|
|
|
+ resList.add(itemMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ //这里折合2015年前的数据
|
|
|
+ if(CollectionUtils.isNotEmpty(resList)){
|
|
|
+ int tmpYear = 2015;
|
|
|
+ Double tmpSingleArea = 0d;
|
|
|
+ Double tmpReportArea = 0d;
|
|
|
+ Integer tmpSingleCount = 0;
|
|
|
+ Integer tmpReportCount = 0;
|
|
|
+
|
|
|
+ List<Map<String,Object>> newResList = new ArrayList<>();
|
|
|
+ for(Map<String,Object> map:resList){
|
|
|
+ String theYear = String.valueOf(map.get("year"));
|
|
|
+ if(StringUtils.isNumeric(theYear) && Integer.parseInt(theYear)>tmpYear){
|
|
|
+ newResList.add(map);
|
|
|
+ }else {
|
|
|
+ tmpSingleArea += (Double) map.get("singleArea");
|
|
|
+ tmpReportArea += (Double) map.get("reportArea");
|
|
|
+ tmpSingleCount += (Integer) map.get("singleCount");
|
|
|
+ tmpReportCount += (Integer) map.get("reportCount");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,Object> itemMap = new HashMap<>();
|
|
|
+ itemMap.put("year","2016年前");
|
|
|
+ itemMap.put("singleArea",tmpSingleArea);
|
|
|
+ itemMap.put("reportArea",tmpReportArea);
|
|
|
+ itemMap.put("singleCount",tmpSingleCount);
|
|
|
+ itemMap.put("reportCount",tmpReportCount);
|
|
|
+ newResList.add(itemMap);
|
|
|
+ resList = newResList;
|
|
|
+ }
|
|
|
+
|
|
|
+ return resList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 年度统计
|
|
|
* @param year
|
|
|
@@ -65,8 +544,8 @@ public class BatchServiceImpl{
|
|
|
year="";
|
|
|
}
|
|
|
BatchRateRes res = new BatchRateRes();
|
|
|
- List<Map<String,Object>> singleBatchList = ydbpMapper.getStatisticsList(year);
|
|
|
- List<YdbpData> reportBatchList = ydbpDataMapper.getStatisticsList(year);
|
|
|
+ List<Map<String,Object>> singleBatchList = ydbpMapper.getStatisticsList(year,"","","",false);
|
|
|
+ List<YdbpData> reportBatchList = ydbpDataMapper.getStatisticsList(year,"","","",false);
|
|
|
if(CollectionUtils.isNotEmpty(singleBatchList)) {
|
|
|
res.setSingleArea(sumAreaForSingle(singleBatchList));
|
|
|
res.setSingleProjectCount(singleBatchList.size());
|