|
@@ -1,6 +1,7 @@
|
|
|
package com.sysu.admin.controller.aland;
|
|
|
|
|
|
import com.querydsl.core.types.Predicate;
|
|
|
+import com.querydsl.core.types.dsl.BooleanExpression;
|
|
|
import com.sysu.admin.controller.city.CityRepository;
|
|
|
import com.sysu.admin.controller.city.DistrictRepository;
|
|
|
import com.sysu.admin.controller.city.DistrictService;
|
|
@@ -48,7 +49,6 @@ public class LandService extends BaseService<Land,Long> {
|
|
|
throw new RuntimeException("district 和 city 至少需要一个");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public List<TownStat> getLandAreaStat(List<Object[]> res ,Double percent, Map<Integer,String> namesMap){
|
|
|
List<TownStat> townStatList = new ArrayList<>(30);
|
|
|
TownStat sumStat = new TownStat();
|
|
@@ -97,7 +97,6 @@ public class LandService extends BaseService<Land,Long> {
|
|
|
return townStatList;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public Double getPercent(Date date){
|
|
|
if(date == null){
|
|
|
return 1.0;
|
|
@@ -107,8 +106,6 @@ public class LandService extends BaseService<Land,Long> {
|
|
|
return percent;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
public List<TownStatCrop> getCropAreaStat(Date date, String districtCode, String city){
|
|
|
Double percent = getPercent(date);
|
|
|
List<Object[]> res = null;
|
|
@@ -174,8 +171,6 @@ public class LandService extends BaseService<Land,Long> {
|
|
|
return townStatList;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
public List<Land> list(String district, Integer townId, Integer limit, String cropType){
|
|
|
limit = limit == null ? 50 : limit;
|
|
|
String wkt = null;
|
|
@@ -188,10 +183,11 @@ public class LandService extends BaseService<Land,Long> {
|
|
|
Predicate predicate = null;
|
|
|
Pageable pageable = PageRequest.of(1, limit, Sort.by(Land.FIELDS.id));
|
|
|
QLand qLand = QLand.land;
|
|
|
- predicate = StringUtils.isNotBlank(cropType) ?
|
|
|
- qLand.crop_type.eq(cropType) :
|
|
|
- null;
|
|
|
- return landRepository.findAll(predicate, pageable).toList();
|
|
|
+ if(StringUtils.isNotBlank(cropType)){
|
|
|
+ return landRepository.findAll(qLand.crop_type.eq(cropType), pageable).toList();
|
|
|
+ }else{
|
|
|
+ return landRepository.findAll(pageable).toList();
|
|
|
+ }
|
|
|
}else{
|
|
|
return StringUtils.isNotBlank(cropType) ?
|
|
|
landRepository.findListByWktAndCropType(wkt, cropType, limit) :
|
|
@@ -199,6 +195,9 @@ public class LandService extends BaseService<Land,Long> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public Land findByPoint(Double[] point){
|
|
|
+ return landRepository.findByPoint("Point("+point[0]+" "+point[1]+")");
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public JpaPlusRepository<Land, Long> r() {
|