添加了动态多条件查询火点信息的接口

This commit is contained in:
DESKTOP-4U0TDEF\20371 2021-07-16 09:22:48 +08:00
parent a447322089
commit b559701d5e
3 changed files with 58 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@ -81,4 +82,32 @@ public class FirePointController {
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,firePointEntities,locale);
}
/**
* 动态多条件查询火点信息
* @param map
* @param token
* @return
*/
@PostMapping("/selectFirePoint")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String selectFirePoint(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 区县编码
String cityCode = (String) map.get("cityCode");
// 卫星类型
String satelliteType = (String) map.get("satelliteType");
// 植被类型
String landType = (String) map.get("landType");
// 开始时间
String startTime = (String) map.get("startTime");
// 结束时间
String endTime = (String) map.get("endTime");
List<FirePointEntity> firePointEntities = firePointService.selectFirePoint(cityCode, satelliteType, landType, startTime, endTime);
if(firePointEntities == null || firePointEntities.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有火点数据",locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,firePointEntities,locale);
}
}

View File

@ -24,4 +24,15 @@ public interface FirePointService {
* @return
*/
List<FirePointEntity> selectTodayFirePoint();
/**
* 动态多条件查询火点信息
* @param cityCode
* @param satelliteType
* @param landType
* @param startTime
* @param endTime
* @return
*/
List<FirePointEntity> selectFirePoint(String cityCode,String satelliteType,String landType,String startTime,String endTime);
}

View File

@ -6,6 +6,7 @@ import com.xkrs.model.qo.FirePointQo;
import com.xkrs.service.FirePointService;
import com.xkrs.utils.AddressUtils;
import com.xkrs.utils.DateTimeUtil;
import com.xkrs.utils.Query;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@ -26,6 +27,9 @@ public class FirePointServiceImpl implements FirePointService {
@Resource
private FirePointDao firePointDao;
@Resource
private Query query;
/**
* 添加火点信息
* @param firePointQo
@ -61,4 +65,18 @@ public class FirePointServiceImpl implements FirePointService {
String addTime = DateTimeUtil.dateToString(LocalDate.now());
return firePointDao.selectTodayFirePoint(addTime);
}
/**
* 动态多条件查询火点信息
* @param cityCode
* @param satelliteType
* @param landType
* @param startTime
* @param endTime
* @return
*/
@Override
public List<FirePointEntity> selectFirePoint(String cityCode, String satelliteType, String landType, String startTime, String endTime) {
return query.selectFirePoint(cityCode, satelliteType, landType, startTime, endTime);
}
}