优化 queryFirePointBroadcast

This commit is contained in:
liuchengqian 2023-03-07 09:57:39 +08:00
parent 722300950d
commit e07ed9ecc1

View File

@ -14,6 +14,7 @@ import com.xkrs.utils.FirePointCodeUtils;
import org.apache.hc.core5.util.TextUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Component;
@ -37,6 +38,17 @@ public class FirePointQueryManager {
@Resource
private FirePointPreciseDao firePointPreciseDao;
public FirePointQueryResultBean queryFirePointBroadcast(Integer limit) {
int size = (limit != null && limit > 0) ? limit : 10;
PageRequest pageRequest = PageRequest.of(1, size, Sort.by(Sort.Direction.DESC, "satelliteTime"));
List<FirePointPreciseEntity> firePointList = firePointPreciseDao.findAll(pageRequest).getContent();
List<AllFirePointVo> resultList = new ArrayList<>();
for (FirePointPreciseEntity firePoint : firePointList) {
resultList.add(FirePointConvertUtils.convert(firePoint));
}
return new FirePointQueryResultBean(true, "", resultList, resultList.size());
}
public FirePointQueryResultBean queryFirePointBelongToUser(SysUserEntity sysUserEntity, String userSubAreaCountyCode, String startTime, String endTime, String satelliteType, String landType) {
String countyCode = sysUserEntity.getCountyCode();
String vipTimeRangeJson = sysUserEntity.getVipTimeRangeJson();