|
@@ -7,8 +7,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 土地闲置统计服务实现类
|
|
@@ -63,7 +62,34 @@ public class TdtjServiceImp implements TdtjService {
|
|
|
|
|
|
@Override
|
|
|
public RequestResult getDistrict() {
|
|
|
- return null;
|
|
|
+ List<Map<String, Object>> listRes = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> districtMaps = tdgyMapper.getAreaByDistrict();
|
|
|
+
|
|
|
+ // 循环totalMap
|
|
|
+ for (Map<String, Object> districtMap : districtMaps) {
|
|
|
+ String districtCode = districtMap.get("districtCode").toString();
|
|
|
+
|
|
|
+ Map<String, Object> mapInfo = new HashMap<>();
|
|
|
+ mapInfo.put("districtName", "");
|
|
|
+ mapInfo.put("districtCode", districtCode);
|
|
|
+ mapInfo.put("totalArea", districtMap.get("totalArea"));
|
|
|
+ mapInfo.put("confirmAre", districtMap.get("confirmArea"));
|
|
|
+ mapInfo.put("disposalArea", districtMap.get("disposalArea"));
|
|
|
+
|
|
|
+ // 计算闲置率
|
|
|
+ BigDecimal totalArea = (BigDecimal) districtMap.get("totalArea");
|
|
|
+ BigDecimal confirmArea = (BigDecimal) districtMap.get("confirmArea");
|
|
|
+ mapInfo.put("idleRate", totalArea.floatValue() ==
|
|
|
+ 0 ? 0 : confirmArea.floatValue() / totalArea.floatValue());
|
|
|
+
|
|
|
+ // 计算处置率
|
|
|
+ BigDecimal disposalArea = (BigDecimal) districtMap.get("disposalArea");
|
|
|
+ mapInfo.put("disposalRate", confirmArea.floatValue() ==
|
|
|
+ 0 ? 0 : disposalArea.floatValue() / confirmArea.floatValue());
|
|
|
+
|
|
|
+ listRes.add(mapInfo);
|
|
|
+ }
|
|
|
+ return RequestResult.success(listRes);
|
|
|
}
|
|
|
|
|
|
@Override
|