diff --git a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java index 9cae962..84215a5 100644 --- a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java +++ b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java @@ -40,7 +40,32 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter { // 所有 /login 用户登录 的POST请求 都放行 .antMatchers(HttpMethod.POST, "/api/login").permitAll() // 所有 app 用户注册 的POST请求 都放行 - .antMatchers(HttpMethod.POST, "/api/person-investigator/add").permitAll().antMatchers("/ws/asset").permitAll().antMatchers(HttpMethod.GET, "/api/user/booleanUserName").permitAll().antMatchers(HttpMethod.POST, "/insertFirePoint").permitAll().antMatchers(HttpMethod.POST, "/insertfirepointchanneltwo").permitAll().antMatchers(HttpMethod.POST, "/insertAppTask").permitAll().antMatchers(HttpMethod.GET, "/selectAppTask").permitAll().antMatchers(HttpMethod.GET, "/selectFirePointBetweenSeven").permitAll().antMatchers(HttpMethod.GET, "/selectFirePointNum").permitAll().antMatchers(HttpMethod.GET, "/api/user/booleanUserName").permitAll().antMatchers(HttpMethod.GET, "/websocketTest").permitAll().antMatchers(HttpMethod.GET, "/selectCityName").permitAll().antMatchers(HttpMethod.GET, "/weather/cityName").permitAll().antMatchers(HttpMethod.GET, "/weather/cityId").permitAll().antMatchers(HttpMethod.GET, "/selectFirePointByCode").permitAll().antMatchers(HttpMethod.POST, "/updateTypeByFireCode").permitAll().antMatchers(HttpMethod.GET, "/api/user/verificationCode").permitAll().antMatchers(HttpMethod.POST, "/uploadFileMore").permitAll().antMatchers(HttpMethod.POST, "/uploadFile").permitAll().antMatchers(HttpMethod.POST, "/insertFireTest").permitAll().antMatchers(HttpMethod.POST, "/importCityExcel").permitAll().antMatchers(HttpMethod.POST, "/deleteShuiTi").permitAll().antMatchers(HttpMethod.GET, "/selectBeijing").permitAll().antMatchers(HttpMethod.GET, "/api/user/verificationCodeUpdate").permitAll().antMatchers(HttpMethod.GET, "/api/user/getVerificationCode").permitAll().antMatchers(HttpMethod.POST, "/api/user/userUnRememberPassword").permitAll().antMatchers(HttpMethod.POST, "/updateBeforeFireAndAfterFireImage").permitAll().antMatchers(HttpMethod.GET, "/getProvinceList").permitAll()//获取省列表 + .antMatchers(HttpMethod.POST, "/api/person-investigator/add").permitAll() + .antMatchers("/ws/asset").permitAll() + .antMatchers(HttpMethod.GET, "/api/user/booleanUserName").permitAll() + .antMatchers(HttpMethod.POST, "/insertFirePoint").permitAll() + .antMatchers(HttpMethod.POST, "/insertfirepointchanneltwo").permitAll() + .antMatchers(HttpMethod.POST, "/insertAppTask").permitAll() + .antMatchers(HttpMethod.GET, "/selectAppTask").permitAll() + .antMatchers(HttpMethod.GET, "/selectFirePointBetweenSeven").permitAll() + .antMatchers(HttpMethod.GET, "/selectFirePointNum").permitAll() + .antMatchers(HttpMethod.GET, "/api/user/booleanUserName").permitAll() + .antMatchers(HttpMethod.GET, "/selectCityName").permitAll() + .antMatchers(HttpMethod.GET, "/weather/cityName").permitAll() + .antMatchers(HttpMethod.GET, "/weather/cityId").permitAll() + .antMatchers(HttpMethod.GET, "/selectFirePointByCode").permitAll() + .antMatchers(HttpMethod.POST, "/updateTypeByFireCode").permitAll() + .antMatchers(HttpMethod.GET, "/api/user/verificationCode").permitAll() + .antMatchers(HttpMethod.POST, "/uploadFileMore").permitAll() + .antMatchers(HttpMethod.POST, "/uploadFile").permitAll() + .antMatchers(HttpMethod.POST, "/importCityExcel").permitAll() + .antMatchers(HttpMethod.POST, "/deleteShuiTi").permitAll() + .antMatchers(HttpMethod.GET, "/selectBeijing").permitAll() + .antMatchers(HttpMethod.GET, "/api/user/verificationCodeUpdate").permitAll() + .antMatchers(HttpMethod.GET, "/api/user/getVerificationCode").permitAll() + .antMatchers(HttpMethod.POST, "/api/user/userUnRememberPassword").permitAll() + .antMatchers(HttpMethod.POST, "/updateBeforeFireAndAfterFireImage").permitAll() + .antMatchers(HttpMethod.GET, "/getProvinceList").permitAll()//获取省列表 .antMatchers(HttpMethod.GET, "/getCityList").permitAll()//根据省编号获取市列表 .antMatchers(HttpMethod.GET, "/getCountyList").permitAll()//根据市编号获取区县列表 .antMatchers(HttpMethod.GET, "/getStreetList").permitAll()//根据区县编号获取街道列表 diff --git a/src/main/java/com/xkrs/controller/FirePointController.java b/src/main/java/com/xkrs/controller/FirePointController.java index 96c2125..1639019 100644 --- a/src/main/java/com/xkrs/controller/FirePointController.java +++ b/src/main/java/com/xkrs/controller/FirePointController.java @@ -5,7 +5,6 @@ import com.xkrs.common.tool.TokenUtil; import com.xkrs.dao.FirePointDao; import com.xkrs.dao.ShanDongFirePointDao; import com.xkrs.dao.SysUserDao; -import com.xkrs.model.entity.FirePoint; import com.xkrs.model.entity.FirePointEntity; import com.xkrs.model.entity.ShanDongFirePointEntity; import com.xkrs.model.entity.SysUserEntity; @@ -15,7 +14,6 @@ import com.xkrs.model.qo.ShanDongFirePointVerifyStateQo; 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.data.domain.Sort; import org.springframework.data.jpa.domain.Specification; @@ -214,10 +212,6 @@ public class FirePointController { /** * 动态多条件查询火点信息 - * - * @param map - * @param token - * @return */ @PostMapping("/selectFirePoint") @PreAuthorize("hasAnyAuthority('auth_general_user')") @@ -283,10 +277,6 @@ public class FirePointController { /** * 提交核查任务 - * - * @param files - * @param appTaskBodyVo - * @return */ @PostMapping("/insertAppTask") public String insertAppTask(@RequestParam("files") MultipartFile[] files, AppTaskBodyVo appTaskBodyVo) throws IOException { @@ -306,9 +296,6 @@ public class FirePointController { /** * 查询核查的任务信息 - * - * @param fireCode - * @return */ @GetMapping("/selectAppTask") public String selectAppTask(@RequestParam("fireCode") String fireCode) throws Exception { @@ -317,8 +304,6 @@ public class FirePointController { /** * 查询近一周的火点信息 - * - * @return */ @GetMapping("/selectFirePointBetweenSeven") public String selectFirePointBetweenSeven() { @@ -333,8 +318,6 @@ public class FirePointController { /** * 查询近一个月的火点信息 - * - * @return */ @GetMapping("/selectFirePointByMonth") @PreAuthorize("hasAnyAuthority('auth_general_user')") @@ -353,8 +336,6 @@ public class FirePointController { /** * 查询火点数量 - * - * @return */ @GetMapping("/selectFirePointNum") public String selectFirePointNum(@RequestParam("keepType") String keepType) { @@ -369,12 +350,6 @@ public class FirePointController { } } - @GetMapping("/websocketTest") - public void websocketTest(@RequestParam("message") String message) { - - WebSocketServer.broadInfo(message); - } - /** * 查询该省所有的市 * @@ -413,24 +388,6 @@ public class FirePointController { return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byFireCode, locale); } - /** - * 测试添加火点信息 - * - * @param firePointQo - * @return - */ - @PostMapping("/insertFireTest") - public String insertFireTest(@RequestBody FirePointQo firePointQo) { - // 获取区域信息 - Locale locale = LocaleContextHolder.getLocale(); - FirePoint firePoint = firePointService.insertFireTest(firePointQo); - if (firePoint == null) { - return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "添加数据失败", locale); - } else { - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功", locale); - } - } - /** * 导入全国省市区 * @@ -446,24 +403,6 @@ public class FirePointController { return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "导入成功", locale); } - /** - * 查询今天的火点信息(测试) - * - * @param token - * @return - */ - @GetMapping("/selectTodayFire") - @PreAuthorize("hasAnyAuthority('auth_general_user')") - public String selectTodayFire(@RequestParam("countyCode") String countyCode, @RequestHeader(value = "Authorization") String token) { - // 获取区域信息 - Locale locale = LocaleContextHolder.getLocale(); - List firePointEntities = firePointService.selectTodayFire(countyCode); - if (firePointEntities == null || firePointEntities.size() == 0) { - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale); - } - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointEntities, locale); - } - /** * 删除水体类型的火点信息 * diff --git a/src/main/java/com/xkrs/dao/CityDao.java b/src/main/java/com/xkrs/dao/CityDao.java index 2be72e0..04814ee 100644 --- a/src/main/java/com/xkrs/dao/CityDao.java +++ b/src/main/java/com/xkrs/dao/CityDao.java @@ -13,56 +13,31 @@ import java.util.Map; * @author xkrs */ @Component -public interface CityDao extends JpaRepository, JpaSpecificationExecutor { - - /** - * 根据省编码查询城市有关信息 - * @param proCode - * @return - */ - @Query(value = "select city_name,city_code,city_latitude,city_longitude from city where pro_code = ?",nativeQuery = true) - List selectCityNameAndLatAndLog(String proCode); +public interface CityDao extends JpaRepository, JpaSpecificationExecutor { /** * 查询所有市和对应的编码 + * * @param code * @return */ - @Query(value = "select city_name cityname,city_code citycode from city where pro_code = :code",nativeQuery = true) - List> selectCityName(String code); - - /** - * 根据市编码查询信息 - * @param cityCode - * @return - */ - CityEntity findByCityCode(String cityCode); + @Query(value = "select city_name cityname,city_code citycode from city where pro_code = :code", nativeQuery = true) + List> selectCityName(String code); /** * 根据省编码查询信息 + * * @param proCode * @return */ List findByProCode(String proCode); - /** - * 根据市名称查询信息 - * @param cityName - * @return - */ - //List findByCityName(String cityName); - /** * 根据省名称查询信息 + * * @param proName * @return */ List findByProName(String proName); - /** - * 根据市名查询信息 - * @param cityName - * @return - */ - CityEntity findByCityName(String cityName); } diff --git a/src/main/java/com/xkrs/dao/FireDao.java b/src/main/java/com/xkrs/dao/FireDao.java deleted file mode 100644 index 8a1117c..0000000 --- a/src/main/java/com/xkrs/dao/FireDao.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.xkrs.dao; - -import com.xkrs.model.entity.FirePoint; -import com.xkrs.model.entity.FirePointEntity; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author XinYi Song - */ -@Component -public interface FireDao extends JpaRepository { - - /** - * 查询今天的火点信息 - * @param addTime - * @param address - * @return - */ - @Query(value = "select * from fire where add_time like CONCAT('%',:addTime,'%') and fire_point_address like CONCAT('%',:address,'%')",nativeQuery = true) - List selectTodayFire(String addTime, String address); - - /** - * 区县条件查询今天火点信息 - * @param addTime - * @param countyCode - * @return - */ - @Query(value = "select * from fire_point where add_time like CONCAT('%',:addTime,'%') and county_code = :countyCode",nativeQuery = true) - List selectTodayFireOne(String addTime,String countyCode); - -} diff --git a/src/main/java/com/xkrs/service/FirePointService.java b/src/main/java/com/xkrs/service/FirePointService.java index 8b0379f..3b75759 100644 --- a/src/main/java/com/xkrs/service/FirePointService.java +++ b/src/main/java/com/xkrs/service/FirePointService.java @@ -1,6 +1,5 @@ package com.xkrs.service; -import com.xkrs.model.entity.FirePoint; import com.xkrs.model.entity.FirePointEntity; import com.xkrs.model.entity.ShanDongFirePointEntity; import com.xkrs.model.qo.FirePointQo; @@ -174,14 +173,6 @@ public interface FirePointService { */ List> selectCountyName(String code); - /** - * 测试插入火点信息 - * - * @param firePointQo - * @return - */ - FirePoint insertFireTest(FirePointQo firePointQo); - /** * 导入全国省市区 * @@ -190,14 +181,6 @@ public interface FirePointService { */ void importCityExcel(MultipartFile file) throws Exception; - /** - * 查询今日火点信息(测试) - * - * @param countyCode - * @return - */ - List selectTodayFire(String countyCode); - /** * 更新火点的街道编号数据 * diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 48e6540..0472b50 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -86,9 +86,6 @@ public class FirePointServiceImpl implements FirePointService { @Resource private StreetDao streetDao; - @Resource - private FireDao fireDao; - @Resource private NationwideDao nationwideDao; @@ -850,33 +847,6 @@ public class FirePointServiceImpl implements FirePointService { return countyDao.selectCountyName(code); } - /** - * 测试插入火点信息 - * - * @param firePointQo - * @return - */ - @Override - public FirePoint insertFireTest(FirePointQo firePointQo) { - FirePoint firePoint = new FirePoint(); - firePoint.setFireCode(firePointQo.getFireCode()); - firePoint.setCountyCode(firePointQo.getCountyCode().toString()); - firePoint.setCountyName(firePointQo.getCountyName()); - firePoint.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue())); - firePoint.setLongitude(firePointQo.getLongitude()); - firePoint.setLatitude(firePointQo.getLatitude()); - firePoint.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(), firePointQo.getLongitude().toString())); - firePoint.setSatelliteType(firePointQo.getSatelliteType()); - firePoint.setLandType(firePointQo.getLandtype()); - firePoint.setConfidence(firePointQo.getConfidence()); - firePoint.setAddTime(dateTimeToString(LocalDateTime.now())); - firePoint.setFireType("0"); - firePoint.setFireImage(firePointQo.getFireImage()); - firePoint.setSatelliteImage(firePointQo.getSatelliteImage()); - log.info("-------发现新火点"); - return fireDao.save(firePoint); - } - /** * 导入全国省市区 * @@ -905,28 +875,6 @@ public class FirePointServiceImpl implements FirePointService { nationwideDao.saveAll(orderDetails); } - /** - * 查询今日的火点信息(测试) - * - * @param countyCode - * @return - */ - @Override - public List selectTodayFire(String countyCode) { - String addTime = DateTimeUtil.dateToString(LocalDate.now()); - if ("0000".equals(countyCode.substring(2))) { - List byProCode = cityDao.findByProCode(countyCode); - String proName = byProCode.get(0).getProName(); - return fireDao.selectTodayFire(addTime, proName); - } else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) { - List byCityCode = countyDao.findByCityCode(countyCode); - String cityName = byCityCode.get(0).getCityName(); - return fireDao.selectTodayFire(addTime, cityName); - } else { - return fireDao.selectTodayFireOne(addTime, countyCode); - } - } - /** * 更新火点的街道编号数据 *