添加了删除水体类型火点信息的接口

This commit is contained in:
DESKTOP-G8BCEP0\HP 2021-10-11 16:28:03 +08:00
parent 7a88b4f8df
commit c6adc85b61
4 changed files with 50 additions and 17 deletions

View File

@ -59,6 +59,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.POST,"/uploadFile").permitAll() .antMatchers(HttpMethod.POST,"/uploadFile").permitAll()
.antMatchers(HttpMethod.POST,"/insertFireTest").permitAll() .antMatchers(HttpMethod.POST,"/insertFireTest").permitAll()
.antMatchers(HttpMethod.POST,"/importCityExcel").permitAll() .antMatchers(HttpMethod.POST,"/importCityExcel").permitAll()
.antMatchers(HttpMethod.POST,"/deleteShuiTi").permitAll()
// 所有其它请求需要身份认证 // 所有其它请求需要身份认证
.anyRequest().authenticated() .anyRequest().authenticated()
.and() .and()

View File

@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -324,4 +325,18 @@ public class FirePointController {
} }
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,firePointEntities,locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,firePointEntities,locale);
} }
/**
* 删除水体类型的火点信息
* @return
*/
@Transactional(rollbackOn = Exception.class)
@PostMapping("/deleteShuiTi")
public String deleteShuiTi(){
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
List<Integer> integers = firePointDao.selectId();
firePointDao.deleteByIdIn(integers);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"删除成功",locale);
}
} }

View File

@ -71,4 +71,18 @@ public interface FirePointDao extends JpaRepository<FirePointEntity,Long>, JpaSp
"on fp.county_code like concat('%',ci.city_code,'%') AND fp.add_time BETWEEN ?1 AND ?2 " + "on fp.county_code like concat('%',ci.city_code,'%') AND fp.add_time BETWEEN ?1 AND ?2 " +
"group by ci.city_name",nativeQuery = true) "group by ci.city_name",nativeQuery = true)
List<Map<String,Object>> selectNumByArea(String startTime,String endTime); List<Map<String,Object>> selectNumByArea(String startTime,String endTime);
/**
* 查询水体类型的id
* @return
*/
@Query(value = "select id from fire_point where land_type = '水体'",nativeQuery = true)
List<Integer> selectId();
/**
* 批量删除水体
* @param id
*/
@Modifying(clearAutomatically=true)
void deleteByIdIn(List<Integer> id);
} }

View File

@ -78,21 +78,24 @@ public class FirePointServiceImpl implements FirePointService {
@Override @Override
public FirePointEntity insertFirePoint(FirePointQo firePointQo) { public FirePointEntity insertFirePoint(FirePointQo firePointQo) {
FirePointEntity firePointEntity = new FirePointEntity(); FirePointEntity firePointEntity = new FirePointEntity();
firePointEntity.setFireCode(firePointQo.getFireCode()); if(firePointQo.getLandtype().equals("水体")){
firePointEntity.setCountyCode(firePointQo.getCountyCode().toString()); return null;
firePointEntity.setCountyName(firePointQo.getCountyName()); }else {
firePointEntity.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue())); firePointEntity.setFireCode(firePointQo.getFireCode());
firePointEntity.setLongitude(firePointQo.getLongitude()); firePointEntity.setCountyCode(firePointQo.getCountyCode().toString());
firePointEntity.setLatitude(firePointQo.getLatitude()); firePointEntity.setCountyName(firePointQo.getCountyName());
firePointEntity.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(),firePointQo.getLongitude().toString())); firePointEntity.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
firePointEntity.setSatelliteType(firePointQo.getSatelliteType()); firePointEntity.setLongitude(firePointQo.getLongitude());
firePointEntity.setLandType(firePointQo.getLandtype()); firePointEntity.setLatitude(firePointQo.getLatitude());
firePointEntity.setConfidence(firePointQo.getConfidence()); firePointEntity.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(),firePointQo.getLongitude().toString()));
firePointEntity.setAddTime(DateTimeUtil.dateTimeToString(LocalDateTime.now())); firePointEntity.setSatelliteType(firePointQo.getSatelliteType());
firePointEntity.setFireType("0"); firePointEntity.setLandType(firePointQo.getLandtype());
firePointEntity.setFireImage(firePointQo.getFireImage()); firePointEntity.setConfidence(firePointQo.getConfidence());
firePointEntity.setSatelliteImage(firePointQo.getSatelliteImage()); firePointEntity.setAddTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()));
log.info("-------发现新火点"); firePointEntity.setFireType("0");
firePointEntity.setFireImage(firePointQo.getFireImage());
firePointEntity.setSatelliteImage(firePointQo.getSatelliteImage());
log.info("-------发现新火点");
/*log.info("---------------开始进行实时通讯,将检测到的火点传给前端"); /*log.info("---------------开始进行实时通讯,将检测到的火点传给前端");
Map map = new HashMap(3); Map map = new HashMap(3);
map.put("countyCode",firePointQo.getCountyCode()); map.put("countyCode",firePointQo.getCountyCode());
@ -109,8 +112,8 @@ public class FirePointServiceImpl implements FirePointService {
String websocket = JSON.toJSONString(map1); String websocket = JSON.toJSONString(map1);
// 将监测到的火点信息返给前端 // 将监测到的火点信息返给前端
WebSocketServer.broadInfo(websocket);*/ WebSocketServer.broadInfo(websocket);*/
return firePointDao.save(firePointEntity); return firePointDao.save(firePointEntity);
}
} }
/** /**