|
@@ -7,12 +7,12 @@ import com.siwei.common.core.utils.StringUtils;
|
|
|
import com.siwei.spatial.api.RemoteSpatialFilesDbService;
|
|
import com.siwei.spatial.api.RemoteSpatialFilesDbService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
|
-import java.math.RoundingMode;
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -37,24 +37,76 @@ public class BatchServiceImpl{
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private YdbpDataMapper ydbpDataMapper;
|
|
private YdbpDataMapper ydbpDataMapper;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 年度统计
|
|
* 年度统计
|
|
|
* @param year
|
|
* @param year
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public BatchRateRes trendStatistics(String year) {
|
|
|
|
|
|
|
+ public List<Map<String,Object>> trendStatistics(String year) {
|
|
|
if (StringUtils.isBlank(year) || "0".equals(year)) {
|
|
if (StringUtils.isBlank(year) || "0".equals(year)) {
|
|
|
year = "";
|
|
year = "";
|
|
|
}
|
|
}
|
|
|
- BatchRateRes res = new BatchRateRes();
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ List<Map<String,Object>> resList = new ArrayList<>();
|
|
|
|
|
+ List<Map<String,Object>> singleBatchList = ydbpMapper.getStatisticsList(year);
|
|
|
|
|
+ List<YdbpData> reportBatchList = ydbpDataMapper.getStatisticsList(year);
|
|
|
|
|
+
|
|
|
|
|
+ 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()){
|
|
|
|
|
+ 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);
|
|
|
|
|
+ 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);
|
|
|
|
|
+ }
|
|
|
|
|
+ return resList;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 年度统计
|
|
* 年度统计
|
|
|
* @param year
|
|
* @param year
|