bug修复,不只返回山东省的火点。

This commit is contained in:
liuchengqian 2022-07-01 17:34:47 +08:00
parent ca85fe23c3
commit d4de89b9fd
3 changed files with 0 additions and 47 deletions

View File

@ -1,7 +0,0 @@
package com.xkrs.service;
public interface GlobalSettingService {
boolean onlyShanDong();
}

View File

@ -1,32 +0,0 @@
package com.xkrs.service.impl;
import com.xkrs.dao.GlobalSettingDao;
import com.xkrs.model.entity.GlobalSettingEntity;
import com.xkrs.service.GlobalSettingService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class GlobalSettingServiceImpl implements GlobalSettingService {
@Resource
private GlobalSettingDao globalSettingDao;
@Override
public boolean onlyShanDong() {
try {
List<GlobalSettingEntity> globalSettingList = globalSettingDao.findAll();
for (GlobalSettingEntity globalSetting : globalSettingList) {
if (globalSetting.getKey().equalsIgnoreCase("OnlyShanDong")) {
return globalSetting.getValue() == 1L;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}

View File

@ -2,7 +2,6 @@ package com.xkrs.utils;
import com.xkrs.dao.FirePointDao; import com.xkrs.dao.FirePointDao;
import com.xkrs.model.entity.FirePointEntity; import com.xkrs.model.entity.FirePointEntity;
import com.xkrs.service.GlobalSettingService;
import org.apache.hc.core5.util.TextUtils; import org.apache.hc.core5.util.TextUtils;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
@ -23,17 +22,10 @@ public class FirePointQueryHelper {
@Resource @Resource
private FirePointDao firePointDao; private FirePointDao firePointDao;
@Resource
private GlobalSettingService globalSettingService;
public List<FirePointEntity> queryFirePoint(String code, String startTime, String endTime, String satelliteType, String landType) { public List<FirePointEntity> queryFirePoint(String code, String startTime, String endTime, String satelliteType, String landType) {
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> { Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
//查询条件集合 //查询条件集合
List<Predicate> predicateList = new ArrayList<>(); List<Predicate> predicateList = new ArrayList<>();
if (globalSettingService.onlyShanDong()) {
predicateList.add(criteriaBuilder.like(root.get("countyCode").as(String.class), "37%"));
predicateList.add(criteriaBuilder.like(root.get("streetCode").as(String.class), "37%"));
}
//添加区划编码查询条件 //添加区划编码查询条件
if (!TextUtils.isEmpty(code)) { if (!TextUtils.isEmpty(code)) {
try { try {