更新火点的街道编号数据
This commit is contained in:
parent
c719cedab2
commit
eb7a966110
@ -10,6 +10,7 @@ import com.xkrs.model.entity.SysUserEntity;
|
||||
import com.xkrs.model.qo.FirePointQo;
|
||||
import com.xkrs.model.vo.AppTaskBodyVo;
|
||||
import com.xkrs.service.FirePointService;
|
||||
import com.xkrs.service.StreetService;
|
||||
import com.xkrs.websocket.service.WebSocketServer;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -19,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@ -40,6 +42,8 @@ public class FirePointController {
|
||||
@Resource
|
||||
private FirePointDao firePointDao;
|
||||
|
||||
@Resource
|
||||
private StreetService streetService;
|
||||
|
||||
/**
|
||||
* 添加火点数据
|
||||
@ -154,7 +158,7 @@ public class FirePointController {
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointEntities, locale);
|
||||
} else {
|
||||
// 查询县
|
||||
List<FirePointEntity> firePointEntities = firePointService.selectFirePointByCounty(sysUserEntity.getCountyCode(), satelliteType, landType, startTime, endTime);
|
||||
List<FirePointEntity> firePointEntities = firePointService.selectFirePointByCounty(sysUserEntity.getCountyCode(), cityCode, satelliteType, landType, startTime, endTime);
|
||||
if (firePointEntities == null || firePointEntities.size() == 0) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
||||
}
|
||||
@ -276,14 +280,20 @@ public class FirePointController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectCityName")
|
||||
public String selectCityName(@RequestParam("code") String code) {
|
||||
public String selectCityName(@RequestParam("code") String countyCode) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
if (code.substring(2).equals("0000")) {
|
||||
List<Map<String, Object>> maps = firePointService.selectCityName(code);
|
||||
if (9 == countyCode.length()) {
|
||||
List<Map<String, String>> maps = new ArrayList<>();
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, maps, locale);
|
||||
} else if ("0000".equals(countyCode.substring(2))) {
|
||||
List<Map<String, String>> maps = streetService.selectCityList(countyCode);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, maps, locale);
|
||||
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||
List<Map<String, String>> maps = streetService.selectCountyList(countyCode);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, maps, locale);
|
||||
} else {
|
||||
List<Map<String, Object>> maps = firePointService.selectCountyName(code);
|
||||
List<Map<String, String>> maps = streetService.selectStreetList(countyCode);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, maps, locale);
|
||||
}
|
||||
}
|
||||
|
@ -44,31 +44,31 @@ public interface FirePointService {
|
||||
*/
|
||||
List<FirePointEntity> selectFirePoint(String proCode, String cityCode, String satelliteType, String landType, String startTime, String endTime);
|
||||
|
||||
|
||||
/**
|
||||
* 动态多条件查询火点信息(市)
|
||||
*
|
||||
* @param cityCodeOne 市编码
|
||||
* @param cityCode 县编码
|
||||
* @param cityCode 市编码
|
||||
* @param countyCode 县编码
|
||||
* @param satelliteType
|
||||
* @param landType
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
List<FirePointEntity> selectFirePointByCity(String cityCodeOne, String cityCode, String satelliteType, String landType, String startTime, String endTime);
|
||||
List<FirePointEntity> selectFirePointByCity(String cityCode, String countyCode, String satelliteType, String landType, String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 动态多条件查询火点信息(县)
|
||||
*
|
||||
* @param cityCode 县编码
|
||||
* @param countyCode 县编码
|
||||
* @param streetCode 街道编码
|
||||
* @param satelliteType
|
||||
* @param landType
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
List<FirePointEntity> selectFirePointByCounty(String cityCode, String satelliteType, String landType, String startTime, String endTime);
|
||||
List<FirePointEntity> selectFirePointByCounty(String countyCode, String streetCode, String satelliteType, String landType, String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 动态多条件查询火点信息(街道)
|
||||
|
@ -198,8 +198,8 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
/**
|
||||
* 动态多条件查询火点信息(市)
|
||||
*
|
||||
* @param cityCodeOne 市编码
|
||||
* @param cityCode 县编码
|
||||
* @param cityCode 市编码
|
||||
* @param countyCode 县编码
|
||||
* @param satelliteType
|
||||
* @param landType
|
||||
* @param startTime
|
||||
@ -208,23 +208,24 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||
@Override
|
||||
public List<FirePointEntity> selectFirePointByCity(String cityCodeOne, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||
List<CountyEntity> byCityCode = countyDao.findByCityCode(cityCodeOne);
|
||||
public List<FirePointEntity> selectFirePointByCity(String cityCode, String countyCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||
List<CountyEntity> byCityCode = countyDao.findByCityCode(cityCode);
|
||||
String cityName = byCityCode.get(0).getCityName();
|
||||
if (!"".equals(startTime) && !"".equals(endTime)) {
|
||||
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
||||
// 结束时间
|
||||
LocalDate localDate1 = localDate.plusDays(1);
|
||||
String dateToString = DateTimeUtil.dateToString(localDate1);
|
||||
return query.selectFirePointByCity(cityName, cityCode, satelliteType, landType, startTime, dateToString);
|
||||
return query.selectFirePointByCity(cityName, countyCode, satelliteType, landType, startTime, dateToString);
|
||||
}
|
||||
return query.selectFirePointByCity(cityName, cityCode, satelliteType, landType, startTime, endTime);
|
||||
return query.selectFirePointByCity(cityName, countyCode, satelliteType, landType, startTime, endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态多条件查询火点信息(县)
|
||||
*
|
||||
* @param cityCode 县编码
|
||||
* @param countyCode 县编码
|
||||
* @param streetCode 街道编码
|
||||
* @param satelliteType
|
||||
* @param landType
|
||||
* @param startTime
|
||||
@ -233,15 +234,15 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||
@Override
|
||||
public List<FirePointEntity> selectFirePointByCounty(String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||
public List<FirePointEntity> selectFirePointByCounty(String countyCode, String streetCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||
if (!"".equals(startTime) && !"".equals(endTime)) {
|
||||
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
||||
// 结束时间
|
||||
LocalDate localDate1 = localDate.plusDays(1);
|
||||
String dateToString = DateTimeUtil.dateToString(localDate1);
|
||||
return query.selectFirePointByCounty(cityCode, satelliteType, landType, startTime, dateToString);
|
||||
return query.selectFirePointByCounty(countyCode, streetCode, satelliteType, landType, startTime, dateToString);
|
||||
}
|
||||
return query.selectFirePointByCounty(cityCode, satelliteType, landType, startTime, endTime);
|
||||
return query.selectFirePointByCounty(countyCode, streetCode, satelliteType, landType, startTime, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,11 +24,11 @@ public class Query {
|
||||
/**
|
||||
* 动态多条件查询项目信息(省)
|
||||
*/
|
||||
public List<FirePointEntity> selectFirePointByPro(String address, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||
public List<FirePointEntity> selectFirePointByPro(String proName, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||
List<Predicate> list = new ArrayList<>();
|
||||
if (address != null && !"".equals(address)) {
|
||||
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + address + "%"));
|
||||
if (proName != null && !"".equals(proName)) {
|
||||
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + proName + "%"));
|
||||
}
|
||||
if (cityCode != null && !"".equals(cityCode)) {
|
||||
list.add(criteriaBuilder.like(root.get("countyCode").as(String.class), "%" + cityCode + "%"));
|
||||
@ -62,14 +62,14 @@ public class Query {
|
||||
/**
|
||||
* 动态多条件查询项目信息(市)
|
||||
*/
|
||||
public List<FirePointEntity> selectFirePointByCity(String address, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||
public List<FirePointEntity> selectFirePointByCity(String cityName, String countyCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||
List<Predicate> list = new ArrayList<>();
|
||||
if (address != null && !"".equals(address)) {
|
||||
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + address + "%"));
|
||||
if (cityName != null && !"".equals(cityName)) {
|
||||
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + cityName + "%"));
|
||||
}
|
||||
if (cityCode != null && !"".equals(cityCode)) {
|
||||
list.add(criteriaBuilder.equal(root.get("countyCode").as(String.class), cityCode));
|
||||
if (countyCode != null && !"".equals(countyCode)) {
|
||||
list.add(criteriaBuilder.like(root.get("countyCode").as(String.class), "%" + countyCode + "%"));
|
||||
}
|
||||
if (satelliteType != null && !"".equals(satelliteType)) {
|
||||
list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));
|
||||
@ -100,11 +100,14 @@ public class Query {
|
||||
/**
|
||||
* 动态多条件查询项目信息(县)
|
||||
*/
|
||||
public List<FirePointEntity> selectFirePointByCounty(String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||
public List<FirePointEntity> selectFirePointByCounty(String countyCode, String streetCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||
List<Predicate> list = new ArrayList<>();
|
||||
if (cityCode != null && !"".equals(cityCode)) {
|
||||
list.add(criteriaBuilder.equal(root.get("countyCode").as(String.class), cityCode));
|
||||
if (countyCode != null && !"".equals(countyCode)) {
|
||||
list.add(criteriaBuilder.like(root.get("countyCode").as(String.class), "%" + countyCode + "%"));
|
||||
}
|
||||
if (streetCode != null && !"".equals(streetCode)) {
|
||||
list.add(criteriaBuilder.like(root.get("streetCode").as(String.class), "%" + streetCode + "%"));
|
||||
}
|
||||
if (satelliteType != null && !"".equals(satelliteType)) {
|
||||
list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));
|
||||
@ -139,7 +142,7 @@ public class Query {
|
||||
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||
List<Predicate> list = new ArrayList<>();
|
||||
if (streetCode != null && !"".equals(streetCode)) {
|
||||
list.add(criteriaBuilder.equal(root.get("streetCode").as(String.class), streetCode));
|
||||
list.add(criteriaBuilder.like(root.get("streetCode").as(String.class), streetCode));
|
||||
}
|
||||
if (satelliteType != null && !"".equals(satelliteType)) {
|
||||
list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));
|
||||
|
Loading…
Reference in New Issue
Block a user