From 5a7ada09c35ea0181c29f07b881722adfa9803b5 Mon Sep 17 00:00:00 2001 From: XinYi Song <2037158277@qq.com> Date: Mon, 10 Jan 2022 11:15:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E9=81=A5=E6=84=9F=E7=AE=97=E6=B3=95=E8=BF=9B=E8=A1=8C=E7=81=AB?= =?UTF-8?q?=E7=82=B9=E5=9B=BE=E7=89=87=E6=B7=BB=E5=8A=A0=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/common/config/WebSecurityConfig.java | 1 + .../xkrs/controller/FirePointController.java | 25 ++++++++++++++ src/main/java/com/xkrs/dao/FirePointDao.java | 10 ++++++ .../java/com/xkrs/model/entity/FirePoint.java | 34 +++++++++++++++++-- .../xkrs/model/entity/FirePointEntity.java | 32 ++++++++++++++++- 5 files changed, 99 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java index 2c54efd..bcac94e 100644 --- a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java +++ b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java @@ -64,6 +64,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter { .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() // 所有其它请求需要身份认证 .anyRequest().authenticated() .and() diff --git a/src/main/java/com/xkrs/controller/FirePointController.java b/src/main/java/com/xkrs/controller/FirePointController.java index 278dd36..6ac55df 100644 --- a/src/main/java/com/xkrs/controller/FirePointController.java +++ b/src/main/java/com/xkrs/controller/FirePointController.java @@ -347,4 +347,29 @@ public class FirePointController { List firePointEntities = firePointDao.selectBeijing(); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,firePointEntities,locale); } + + /** + * 根据火点编码添加火点前后的图片 + * @param map + * @return + */ + @Transactional(rollbackOn = Exception.class) + @PostMapping("/updateBeforeFireAndAfterFireImage") + public String updateBeforeFireAndAfterFireImage(@RequestBody Map map){ + // 获取区域信息 + Locale locale = LocaleContextHolder.getLocale(); + String fireCode = (String) map.get("fireCode"); + String beforeFireImage = (String) map.get("beforeFireImage"); + String afterFireImage = (String) map.get("afterFireImage"); + if(fireCode == null || "".equals(fireCode)){ + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"火点编码不能为空!",locale); + } + FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode); + if(byFireCode == null){ + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"火点编码错误!",locale); + } + firePointDao.updateBeforeFireAndAfterFireImage(fireCode,beforeFireImage,afterFireImage); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加图片成功!",locale); + } + } diff --git a/src/main/java/com/xkrs/dao/FirePointDao.java b/src/main/java/com/xkrs/dao/FirePointDao.java index 0319e15..821c11e 100644 --- a/src/main/java/com/xkrs/dao/FirePointDao.java +++ b/src/main/java/com/xkrs/dao/FirePointDao.java @@ -110,4 +110,14 @@ public interface FirePointDao extends JpaRepository, JpaSp */ @Query(value = "select * from fire_point fp where fp.fire_point_address like concat('%','北京市','%') and fp.add_time BETWEEN '2021-10-19' AND '2021-11-20'",nativeQuery = true) List selectBeijing(); + + /** + * 根据火点编码,修改火点前后图片路径 + * @param fireCode + * @param beforeFireImage + * @param afterFireImage + */ + @Modifying(clearAutomatically=true) + @Query(value = "update fire_point set before_fire_image = ?2,after_fire_image = ?3 where fire_code = ?1",nativeQuery = true) + void updateBeforeFireAndAfterFireImage(String fireCode, String beforeFireImage, String afterFireImage); } diff --git a/src/main/java/com/xkrs/model/entity/FirePoint.java b/src/main/java/com/xkrs/model/entity/FirePoint.java index 77df8bf..e08ddf9 100644 --- a/src/main/java/com/xkrs/model/entity/FirePoint.java +++ b/src/main/java/com/xkrs/model/entity/FirePoint.java @@ -93,11 +93,21 @@ public class FirePoint { */ private String satelliteImage; + /** + * 火点前的图片 + */ + private String beforeFireImage; + + /** + * 火点后的图片 + */ + private String afterFireImage; + public FirePoint() { } - public FirePoint(Integer id, String fireCode, double longitude, double latitude, String countyCode, String countyName, String satelliteTime, String satelliteType, String landType, String addTime, String confidence, String firePointAddress, String fireType, String fireImage, String satelliteImage) { + public FirePoint(Integer id, String fireCode, double longitude, double latitude, String countyCode, String countyName, String satelliteTime, String satelliteType, String landType, String addTime, String confidence, String firePointAddress, String fireType, String fireImage, String satelliteImage, String beforeFireImage, String afterFireImage) { this.id = id; this.fireCode = fireCode; this.longitude = longitude; @@ -113,6 +123,8 @@ public class FirePoint { this.fireType = fireType; this.fireImage = fireImage; this.satelliteImage = satelliteImage; + this.beforeFireImage = beforeFireImage; + this.afterFireImage = afterFireImage; } public Integer getId() { @@ -235,9 +247,25 @@ public class FirePoint { this.satelliteImage = satelliteImage; } + public String getBeforeFireImage() { + return beforeFireImage; + } + + public void setBeforeFireImage(String beforeFireImage) { + this.beforeFireImage = beforeFireImage; + } + + public String getAfterFireImage() { + return afterFireImage; + } + + public void setAfterFireImage(String afterFireImage) { + this.afterFireImage = afterFireImage; + } + @Override public String toString() { - return "FirePointEntity{" + + return "FirePoint{" + "id=" + id + ", fireCode='" + fireCode + '\'' + ", longitude=" + longitude + @@ -253,6 +281,8 @@ public class FirePoint { ", fireType='" + fireType + '\'' + ", fireImage='" + fireImage + '\'' + ", satelliteImage='" + satelliteImage + '\'' + + ", beforeFireImage='" + beforeFireImage + '\'' + + ", afterFireImage='" + afterFireImage + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/model/entity/FirePointEntity.java b/src/main/java/com/xkrs/model/entity/FirePointEntity.java index f5f8fd7..8eefb60 100644 --- a/src/main/java/com/xkrs/model/entity/FirePointEntity.java +++ b/src/main/java/com/xkrs/model/entity/FirePointEntity.java @@ -95,12 +95,22 @@ public class FirePointEntity implements Serializable { */ private String satelliteImage; + /** + * 火点前的图片 + */ + private String beforeFireImage; + + /** + * 火点后的图片 + */ + private String afterFireImage; + public FirePointEntity() { } - public FirePointEntity(Integer id, String fireCode, double longitude, double latitude, String countyCode, String countyName, String satelliteTime, String satelliteType, String landType, String addTime, String confidence, String firePointAddress, String fireType, String fireImage, String satelliteImage) { + public FirePointEntity(Integer id, String fireCode, double longitude, double latitude, String countyCode, String countyName, String satelliteTime, String satelliteType, String landType, String addTime, String confidence, String firePointAddress, String fireType, String fireImage, String satelliteImage, String beforeFireImage, String afterFireImage) { this.id = id; this.fireCode = fireCode; this.longitude = longitude; @@ -116,6 +126,8 @@ public class FirePointEntity implements Serializable { this.fireType = fireType; this.fireImage = fireImage; this.satelliteImage = satelliteImage; + this.beforeFireImage = beforeFireImage; + this.afterFireImage = afterFireImage; } public Integer getId() { @@ -238,6 +250,22 @@ public class FirePointEntity implements Serializable { this.satelliteImage = satelliteImage; } + public String getBeforeFireImage() { + return beforeFireImage; + } + + public void setBeforeFireImage(String beforeFireImage) { + this.beforeFireImage = beforeFireImage; + } + + public String getAfterFireImage() { + return afterFireImage; + } + + public void setAfterFireImage(String afterFireImage) { + this.afterFireImage = afterFireImage; + } + @Override public String toString() { return "FirePointEntity{" + @@ -256,6 +284,8 @@ public class FirePointEntity implements Serializable { ", fireType='" + fireType + '\'' + ", fireImage='" + fireImage + '\'' + ", satelliteImage='" + satelliteImage + '\'' + + ", beforeFireImage='" + beforeFireImage + '\'' + + ", afterFireImage='" + afterFireImage + '\'' + '}'; } }