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

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,"/insertFireTest").permitAll()
.antMatchers(HttpMethod.POST,"/importCityExcel").permitAll()
.antMatchers(HttpMethod.POST,"/deleteShuiTi").permitAll()
// 所有其它请求需要身份认证
.anyRequest().authenticated()
.and()

View File

@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
@ -324,4 +325,18 @@ public class FirePointController {
}
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 " +
"group by ci.city_name",nativeQuery = true)
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
public FirePointEntity insertFirePoint(FirePointQo firePointQo) {
FirePointEntity firePointEntity = new FirePointEntity();
firePointEntity.setFireCode(firePointQo.getFireCode());
firePointEntity.setCountyCode(firePointQo.getCountyCode().toString());
firePointEntity.setCountyName(firePointQo.getCountyName());
firePointEntity.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
firePointEntity.setLongitude(firePointQo.getLongitude());
firePointEntity.setLatitude(firePointQo.getLatitude());
firePointEntity.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(),firePointQo.getLongitude().toString()));
firePointEntity.setSatelliteType(firePointQo.getSatelliteType());
firePointEntity.setLandType(firePointQo.getLandtype());
firePointEntity.setConfidence(firePointQo.getConfidence());
firePointEntity.setAddTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()));
firePointEntity.setFireType("0");
firePointEntity.setFireImage(firePointQo.getFireImage());
firePointEntity.setSatelliteImage(firePointQo.getSatelliteImage());
log.info("-------发现新火点");
if(firePointQo.getLandtype().equals("水体")){
return null;
}else {
firePointEntity.setFireCode(firePointQo.getFireCode());
firePointEntity.setCountyCode(firePointQo.getCountyCode().toString());
firePointEntity.setCountyName(firePointQo.getCountyName());
firePointEntity.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
firePointEntity.setLongitude(firePointQo.getLongitude());
firePointEntity.setLatitude(firePointQo.getLatitude());
firePointEntity.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(),firePointQo.getLongitude().toString()));
firePointEntity.setSatelliteType(firePointQo.getSatelliteType());
firePointEntity.setLandType(firePointQo.getLandtype());
firePointEntity.setConfidence(firePointQo.getConfidence());
firePointEntity.setAddTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()));
firePointEntity.setFireType("0");
firePointEntity.setFireImage(firePointQo.getFireImage());
firePointEntity.setSatelliteImage(firePointQo.getSatelliteImage());
log.info("-------发现新火点");
/*log.info("---------------开始进行实时通讯,将检测到的火点传给前端");
Map map = new HashMap(3);
map.put("countyCode",firePointQo.getCountyCode());
@ -109,8 +112,8 @@ public class FirePointServiceImpl implements FirePointService {
String websocket = JSON.toJSONString(map1);
// 将监测到的火点信息返给前端
WebSocketServer.broadInfo(websocket);*/
return firePointDao.save(firePointEntity);
return firePointDao.save(firePointEntity);
}
}
/**