Administrator 2 years ago
parent
commit
5742b13eb8

+ 2 - 2
src/main/java/com/sysu/admin/controller/aland/LandRepository.java

@@ -19,10 +19,10 @@ public interface LandRepository extends JpaPlusRepository<Land, Long> {
     @Query(value = "select district_code,parcel_type,sum(area),count(id) from leizhou_land where district_code is not null and district_code like ?1 group by district_code,parcel_type",nativeQuery = true)
     List<Object[]> statDistrictParcelTypeAll(String likeCity);
 
-    @Query(value = "select district_code, sum(area * dan_chan) from leizhou_land where district_code is not null and district_code like ?1 and crop_type = ?2 group by district_code",nativeQuery = true)
+    @Query(value = "select district_code, sum(area * dan_chan),sum(area) as areasum from leizhou_land where district_code is not null and district_code like ?1 and crop_type = ?2 group by district_code",nativeQuery = true)
     List<Object[]> statDistrictEstimate(String likeCity, String crop_type);
 
-    @Query(value = "select town_id,sum(area * dan_chan) from  leizhou_land where district_code = ?1 and town_id is not null and crop_type = ?2 group by town_id",nativeQuery = true)
+    @Query(value = "select town_id,sum(area * dan_chan),sum(area) as areasum from  leizhou_land where district_code = ?1 and town_id is not null and crop_type = ?2 group by town_id",nativeQuery = true)
     List<Object[]> statTownEstimate(String districtCode, String crop_type);
 
 

+ 2 - 0
src/main/java/com/sysu/admin/controller/aland/LandService.java

@@ -284,6 +284,8 @@ public class LandService extends BaseService<Land,Long> {
             statEstimate.setTownId(Integer.valueOf(objects[0].toString()));
             statEstimate.setTownName(namesMap.get(statEstimate.getTownId()));
             statEstimate.setValue(Double.valueOf(objects[1].toString()));
+            Double area =Double.valueOf(objects[2].toString());
+            statEstimate.setArea((area + area / 2) / 1000);
             list.add(statEstimate);
         }
         return list;

+ 2 - 0
src/main/java/com/sysu/admin/controller/aland/StatEstimate.java

@@ -14,5 +14,7 @@ public class StatEstimate {
     private String townName;
     @JSONField(ordinal = 2)
     private Double value;
+    @JSONField(ordinal = 3)
+    private Double area;
 
 }

+ 5 - 0
src/main/java/com/sysu/admin/site/lz/LzAreaController.java

@@ -18,6 +18,11 @@ public class LzAreaController {
     @Autowired
     private LzAreaService lzAreaService;
 
+    @RequestMapping("/list")
+    public BaseResult list(){
+        return R.succ(lzAreaService.findAll());
+    }
+
     @RequestMapping("/save")
     public BaseResult save(@RequestBody LzArea bean){
         bean.setGeom((MultiPolygon) GeoCastUtil.wktToGeom(bean.getWkt()));