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