|
|
@@ -7,11 +7,9 @@ import com.siwei.apply.domain.vo.LandSupplyProjectVO;
|
|
|
import com.siwei.apply.mapper.GjShijiShouchuMapper;
|
|
|
import com.siwei.apply.mapper.GjShouchuJihuaMapper;
|
|
|
import com.siwei.common.core.utils.StringUtils;
|
|
|
-import com.siwei.system.api.domain.SysDictData;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
@@ -28,20 +26,23 @@ public class StorageServiceImpl {
|
|
|
private GjShouchuJihuaMapper gjShouchuJihuaMapper;
|
|
|
|
|
|
|
|
|
-
|
|
|
//统计分析
|
|
|
- public LandStorageReportDTO stroageProgress(String startTime,String endTime) {
|
|
|
+ public LandStorageReportDTO stroageProgress(String startYear, String endYear) {
|
|
|
LandStorageReportDTO report = new LandStorageReportDTO();
|
|
|
+
|
|
|
+ startYear = "2025";
|
|
|
+ endYear = "2026";
|
|
|
+
|
|
|
report.setTitle("收储进度分析报表");
|
|
|
- report.setStatTimeRange(startTime + " 至 " + endTime);
|
|
|
+ report.setStatTimeRange(startYear + " 至 " + endYear);
|
|
|
|
|
|
- String year = "2025";
|
|
|
List<LandStorageReportDTO.DetailDTO> details = new ArrayList<>();
|
|
|
- List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null, null, null);
|
|
|
+ List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(null, startYear,endYear,null, null, null);
|
|
|
Map<String, List<TdgyStatisticsRes>> completeMap = completeList.stream().collect(Collectors.groupingBy(TdgyStatisticsRes::getTdyt));
|
|
|
// 这里处理计划数据
|
|
|
- List<TdgyStatisticsRes> planList = gjShouchuJihuaMapper.getPlanListByYear(year, null);
|
|
|
- Set<String> categorySet = completeMap.keySet();
|
|
|
+ List<TdgyStatisticsRes> planList = gjShouchuJihuaMapper.getPlanListByYear(null,startYear,endYear, null);
|
|
|
+ Set<String> categorySet = new HashSet<>(completeMap.keySet());
|
|
|
+ categorySet.add("其它");
|
|
|
Map<String, List<TdgyStatisticsRes>> groupedPlan = planList.stream()
|
|
|
.collect(Collectors.groupingBy(
|
|
|
s -> {
|
|
|
@@ -53,39 +54,123 @@ public class StorageServiceImpl {
|
|
|
}
|
|
|
));
|
|
|
|
|
|
-
|
|
|
for(String category : categorySet){
|
|
|
LandStorageReportDTO.DetailDTO tmpDetailDTO = new LandStorageReportDTO.DetailDTO();
|
|
|
- List<TdgyStatisticsRes> categoryPlanList = groupedPlan.get(category);
|
|
|
LandStorageReportDTO.PlanDTO plan = new LandStorageReportDTO.PlanDTO();
|
|
|
- plan.setCount(categoryPlanList.size());
|
|
|
- double totalArea = categoryPlanList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
|
|
|
- plan.setArea(totalArea);
|
|
|
+ plan.setCount(0);
|
|
|
+ plan.setArea(0D);
|
|
|
plan.setCost(0F);
|
|
|
- tmpDetailDTO.setPlan(plan);
|
|
|
+ plan.setMethod1(0);
|
|
|
+ plan.setMethod2(0);
|
|
|
+ plan.setOtherMethod(0);
|
|
|
+
|
|
|
+ List<TdgyStatisticsRes> categoryPlanList = groupedPlan.get(category);
|
|
|
+ if(CollectionUtils.isNotEmpty(categoryPlanList)){
|
|
|
+ plan.setCount(categoryPlanList.size());
|
|
|
+ double totalArea = categoryPlanList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
|
|
|
+ plan.setArea(totalArea);
|
|
|
+ float totalCost = (float) categoryPlanList.stream().mapToDouble(item -> item.getCost().floatValue()).sum();
|
|
|
+ plan.setCost(totalCost);
|
|
|
+
|
|
|
+ Map<String, List<TdgyStatisticsRes>> resultMap = categoryPlanList.stream()
|
|
|
+ .collect(Collectors.groupingBy(item -> {
|
|
|
+ String gyfs = item.getGyfs();
|
|
|
+ //为空赋值“其它”
|
|
|
+ if (StringUtils.isBlank(gyfs)) {
|
|
|
+ return "其它";
|
|
|
+ }
|
|
|
+ return gyfs;
|
|
|
+ }));
|
|
|
+ if(resultMap.containsKey("收购")){
|
|
|
+ plan.setMethod1(resultMap.get("收购").size());
|
|
|
+ }
|
|
|
+ if(resultMap.containsKey("征收")){
|
|
|
+ plan.setMethod2(resultMap.get("征收").size());
|
|
|
+ }
|
|
|
+ if(resultMap.containsKey("其它")){
|
|
|
+ plan.setOtherMethod(resultMap.get("其它").size());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ tmpDetailDTO.setPlan(plan);
|
|
|
List<TdgyStatisticsRes> categoryCompleteList = completeMap.get(category);
|
|
|
LandStorageReportDTO.CompletedDTO complete = new LandStorageReportDTO.CompletedDTO();
|
|
|
- complete.setCost(0f);
|
|
|
- totalArea = categoryCompleteList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
|
|
|
- complete.setArea(totalArea);
|
|
|
- complete.setCount(categoryCompleteList.size());
|
|
|
- complete.setMethod1(null);
|
|
|
+ complete.setCount(0);
|
|
|
+ complete.setArea(0D);
|
|
|
+ complete.setCost(0F);
|
|
|
+ complete.setMethod1(0);
|
|
|
+ complete.setMethod2(0);
|
|
|
+ complete.setOtherMethod(0);
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(categoryCompleteList)){
|
|
|
+ double totalArea = categoryCompleteList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
|
|
|
+ complete.setArea(totalArea);
|
|
|
+ complete.setCount(categoryCompleteList.size());
|
|
|
+ float totalCost = (float) categoryCompleteList.stream().mapToDouble(item -> item.getCost().floatValue()).sum();
|
|
|
+ complete.setCost(totalCost);
|
|
|
+
|
|
|
+ Map<String, List<TdgyStatisticsRes>> resultMap = categoryCompleteList.stream()
|
|
|
+ .collect(Collectors.groupingBy(item -> {
|
|
|
+ String gyfs = item.getGyfs();
|
|
|
+ //为空赋值“其它”
|
|
|
+ if (StringUtils.isBlank(gyfs)) {
|
|
|
+ return "其它";
|
|
|
+ }
|
|
|
+ return gyfs;
|
|
|
+ }));
|
|
|
+ if(resultMap.containsKey("收购")){
|
|
|
+ complete.setMethod1(resultMap.get("收购").size());
|
|
|
+ }
|
|
|
+ if(resultMap.containsKey("征收")){
|
|
|
+ complete.setMethod2(resultMap.get("征收").size());
|
|
|
+ }
|
|
|
+ if(resultMap.containsKey("其它")){
|
|
|
+ complete.setOtherMethod(resultMap.get("其它").size());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
tmpDetailDTO.setCompleted(complete);
|
|
|
tmpDetailDTO.setCategory(category);
|
|
|
- tmpDetailDTO.setProgress(String.valueOf(categoryCompleteList.size()/categoryPlanList.size()));
|
|
|
+ tmpDetailDTO.setProgress("0");
|
|
|
+ if(plan.getCount()>0){
|
|
|
+ tmpDetailDTO.setProgress(String.format("%.2f%%", (complete.getCount()*100.0 / plan.getCount()) ));
|
|
|
+ }
|
|
|
details.add(tmpDetailDTO);
|
|
|
}
|
|
|
report.setDetails(details);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- return null;
|
|
|
+ //这里处理加总数据
|
|
|
+ LandStorageReportDTO.SummaryDTO summary = new LandStorageReportDTO.SummaryDTO();
|
|
|
+ LandStorageReportDTO.TotalDTO total = new LandStorageReportDTO.TotalDTO();
|
|
|
+ LandStorageReportDTO.CompletedDTO totalCompleted = new LandStorageReportDTO.CompletedDTO();
|
|
|
+ totalCompleted.setCount(completeList.size());
|
|
|
+ float totalCost = (float) completeList.stream().mapToDouble(item -> item.getCost().floatValue()).sum();
|
|
|
+ totalCompleted.setCost(totalCost);
|
|
|
+ double totalArea = completeList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
|
|
|
+ totalCompleted.setArea(totalArea);
|
|
|
+
|
|
|
+ //这里处理计划的数据
|
|
|
+ LandStorageReportDTO.PlanDTO totalPlan = new LandStorageReportDTO.PlanDTO();
|
|
|
+ totalPlan.setCount(planList.size());
|
|
|
+ //这里计算成本
|
|
|
+ totalCost = (float) planList.stream().mapToDouble(item -> item.getCost().floatValue()).sum();
|
|
|
+ totalPlan.setCost(totalCost);
|
|
|
+ //这里计算面积
|
|
|
+ totalArea = planList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
|
|
|
+ totalPlan.setArea(totalArea);
|
|
|
+ String progress = String.format("%.2f%%", (totalCompleted.getCount()*100.0 / totalPlan.getCount()));
|
|
|
+ total.setProgress(progress);
|
|
|
+ total.setCompleted(totalCompleted);
|
|
|
+ total.setPlan(totalPlan);
|
|
|
+ summary.setTotal(total);
|
|
|
+ report.setSummary(summary);
|
|
|
+ return report;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
//统计分析
|
|
|
public List<TrendStatisticsData> getData1() {
|
|
|
List<Map<String, Object>> statsList = gjShijiShouchuMapper.getStatsByYear();
|
|
|
@@ -124,7 +209,7 @@ public class StorageServiceImpl {
|
|
|
StorageYearStatisticsRes res = new StorageYearStatisticsRes();
|
|
|
|
|
|
Map<String, Object> planSummary = gjShouchuJihuaMapper.getPlanSummaryByYear(year);
|
|
|
- List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null, null, null);
|
|
|
+ List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null, null, null, null, null);
|
|
|
BigDecimal planArea = toBigDecimal(planSummary == null ? null : planSummary.get("plan_area"));
|
|
|
int planCount = toInteger(planSummary == null ? null : planSummary.get("plan_project_count"));
|
|
|
BigDecimal completeArea = sumArea(completeList);
|
|
|
@@ -191,7 +276,7 @@ public class StorageServiceImpl {
|
|
|
}
|
|
|
|
|
|
private List<LandSupplyProjectVO> buildPlanProjectList(String year, String keyWord) {
|
|
|
- List<TdgyStatisticsRes> planList = gjShouchuJihuaMapper.getPlanListByYear(year, keyWord);
|
|
|
+ List<TdgyStatisticsRes> planList = gjShouchuJihuaMapper.getPlanListByYear(year,null,null, keyWord);
|
|
|
if (CollectionUtils.isEmpty(planList)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
@@ -212,7 +297,7 @@ public class StorageServiceImpl {
|
|
|
}
|
|
|
|
|
|
private List<LandSupplyProjectVO> buildCompleteProjectList(String year) {
|
|
|
- List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null, null, null);
|
|
|
+ List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null,null,null, null, null);
|
|
|
if (CollectionUtils.isEmpty(completeList)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|