diff --git a/src/main/java/com/xkrs/controller/FirePointController.java b/src/main/java/com/xkrs/controller/FirePointController.java index ce10e01..153efb7 100644 --- a/src/main/java/com/xkrs/controller/FirePointController.java +++ b/src/main/java/com/xkrs/controller/FirePointController.java @@ -7,6 +7,7 @@ import com.xkrs.dao.SysUserDao; import com.xkrs.model.entity.FirePoint; import com.xkrs.model.entity.FirePointEntity; import com.xkrs.model.entity.SysUserEntity; +import com.xkrs.model.qo.AuditFireTypeQo; import com.xkrs.model.qo.FirePointQo; import com.xkrs.model.vo.AppTaskBodyVo; import com.xkrs.service.FirePointService; @@ -63,6 +64,24 @@ public class FirePointController { } } + /** + * 根据火点编码修改审核火点状态 + */ + @Transactional(rollbackOn = Exception.class) + @PostMapping("/updateauditfiretype") + public String updateAuditFireType(@RequestBody AuditFireTypeQo auditFireTypeQo) { + // 获取区域信息 + Locale locale = LocaleContextHolder.getLocale(); + String fireCode = auditFireTypeQo.getFireCode(); + String auditFireType = auditFireTypeQo.getAuditFireType(); + FirePointEntity firePointByFireCode = firePointDao.findByFireCode(fireCode); + if (firePointByFireCode == null) { + return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "修改失败,没有指定的火点编号", locale); + } + firePointDao.updateAuditFireTypeByFireCode(fireCode, auditFireType); + 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 ce94d45..e33a2fa 100644 --- a/src/main/java/com/xkrs/dao/FirePointDao.java +++ b/src/main/java/com/xkrs/dao/FirePointDao.java @@ -62,9 +62,18 @@ public interface FirePointDao extends JpaRepository, JpaS * @param fireType */ @Modifying(clearAutomatically = true) - @Query(value = "update fire_point set fire_type = ?2 where fire_code = ?1", nativeQuery = true) + @Query(value = "UPDATE fire_point SET fire_type = ?2 WHERE fire_code = ?1", nativeQuery = true) void updateFireTypeByFireCode(String fireCode, String fireType); + /** + * 根据火点编码修改审核火点状态 + * @param fireCode + * @param auditFireType + */ + @Modifying(clearAutomatically = true) + @Query(value = "UPDATE fire_point SET audit_fire_type = ?2 WHERE fire_code = ?1", nativeQuery = true) + void updateAuditFireTypeByFireCode(String fireCode, String auditFireType); + /** * 查询时间段内各植被类型的火点数量 * @@ -132,4 +141,5 @@ public interface FirePointDao extends JpaRepository, JpaS @Modifying(clearAutomatically = true) @Query(value = "UPDATE fire_point SET street_code = ?2 WHERE id = ?1", nativeQuery = true) void updateStreetCodeById(Integer id, String streetCode); + } diff --git a/src/main/java/com/xkrs/model/entity/FirePointEntity.java b/src/main/java/com/xkrs/model/entity/FirePointEntity.java index eadf369..dd411b4 100644 --- a/src/main/java/com/xkrs/model/entity/FirePointEntity.java +++ b/src/main/java/com/xkrs/model/entity/FirePointEntity.java @@ -114,6 +114,15 @@ public class FirePointEntity implements Serializable { @Column(length = 65, columnDefinition = "varchar(85)") private String streetName; + /** + * 审核火点状态 + * 0:未审核 + * 1:审核通过 + * 2:审核未通过 + */ + @Column(length = 65, columnDefinition = "varchar(85)") + private String auditFireType; + public FirePointEntity() { } @@ -269,28 +278,16 @@ public class FirePointEntity implements Serializable { this.streetName = streetName; } + public String getAuditFireType() { + return auditFireType; + } + + public void setAuditFireType(String auditFireType) { + this.auditFireType = auditFireType; + } + @Override public String toString() { - return "FirePointEntity{" + - "id=" + id + - ", fireCode='" + fireCode + '\'' + - ", longitude=" + longitude + - ", latitude=" + latitude + - ", countyCode='" + countyCode + '\'' + - ", countyName='" + countyName + '\'' + - ", satelliteTime='" + satelliteTime + '\'' + - ", satelliteType='" + satelliteType + '\'' + - ", landType='" + landType + '\'' + - ", addTime='" + addTime + '\'' + - ", confidence='" + confidence + '\'' + - ", firePointAddress='" + firePointAddress + '\'' + - ", fireType='" + fireType + '\'' + - ", fireImage='" + fireImage + '\'' + - ", satelliteImage='" + satelliteImage + '\'' + - ", beforeFireImage='" + beforeFireImage + '\'' + - ", afterFireImage='" + afterFireImage + '\'' + - ", streetCode='" + streetCode + '\'' + - ", streetName='" + streetName + '\'' + - '}'; + return "FirePointEntity{" + "id=" + id + ", fireCode='" + fireCode + '\'' + ", longitude=" + longitude + ", latitude=" + latitude + ", countyCode='" + countyCode + '\'' + ", countyName='" + countyName + '\'' + ", satelliteTime='" + satelliteTime + '\'' + ", satelliteType='" + satelliteType + '\'' + ", landType='" + landType + '\'' + ", addTime='" + addTime + '\'' + ", confidence='" + confidence + '\'' + ", firePointAddress='" + firePointAddress + '\'' + ", fireType='" + fireType + '\'' + ", fireImage='" + fireImage + '\'' + ", satelliteImage='" + satelliteImage + '\'' + ", beforeFireImage='" + beforeFireImage + '\'' + ", afterFireImage='" + afterFireImage + '\'' + ", streetCode='" + streetCode + '\'' + ", streetName='" + streetName + '\'' + ", auditFireType='" + auditFireType + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/model/qo/AuditFireTypeQo.java b/src/main/java/com/xkrs/model/qo/AuditFireTypeQo.java new file mode 100644 index 0000000..ceabfa5 --- /dev/null +++ b/src/main/java/com/xkrs/model/qo/AuditFireTypeQo.java @@ -0,0 +1,38 @@ +package com.xkrs.model.qo; + +import com.xkrs.model.validation.AuditFireTypeQoUpdate; + +import javax.validation.constraints.NotNull; + +public class AuditFireTypeQo { + + @NotNull(message = "{FirePoint.fireCode.blank}", groups = {AuditFireTypeQoUpdate.class}) + private String fireCode; + + @NotNull(message = "{FirePoint.auditFireType.blank}", groups = {AuditFireTypeQoUpdate.class}) + private String auditFireType; + + public AuditFireTypeQo() { + } + + public String getFireCode() { + return fireCode; + } + + public void setFireCode(String fireCode) { + this.fireCode = fireCode; + } + + public String getAuditFireType() { + return auditFireType; + } + + public void setAuditFireType(String auditFireType) { + this.auditFireType = auditFireType; + } + + @Override + public String toString() { + return "AuditFireTypeQo{" + "fireCode='" + fireCode + '\'' + ", auditFireType='" + auditFireType + '\'' + '}'; + } +} diff --git a/src/main/java/com/xkrs/model/validation/AuditFireTypeQoUpdate.java b/src/main/java/com/xkrs/model/validation/AuditFireTypeQoUpdate.java new file mode 100644 index 0000000..3491edd --- /dev/null +++ b/src/main/java/com/xkrs/model/validation/AuditFireTypeQoUpdate.java @@ -0,0 +1,4 @@ +package com.xkrs.model.validation; + +public interface AuditFireTypeQoUpdate { +} diff --git a/src/main/java/com/xkrs/service/FirePointService.java b/src/main/java/com/xkrs/service/FirePointService.java index 1c206e0..6a3dad2 100644 --- a/src/main/java/com/xkrs/service/FirePointService.java +++ b/src/main/java/com/xkrs/service/FirePointService.java @@ -82,7 +82,6 @@ public interface FirePointService { */ List selectFirePointByStreet(String streetCode, String satelliteType, String landType, String startTime, String endTime); - /** * 根据火点编码修改火点的状态(预警) * @@ -194,4 +193,5 @@ public interface FirePointService { * @return */ String updateFirePointStreetCode(); + } diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 4de09ab..f66a386 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -117,6 +117,7 @@ public class FirePointServiceImpl implements FirePointService { firePointEntity.setFireType("0"); firePointEntity.setFireImage(firePointQo.getFireImage()); firePointEntity.setSatelliteImage(firePointQo.getSatelliteImage()); + firePointEntity.setAuditFireType("0");//初始化火点为未审核状态 try { bindStreetCodeName(firePointEntity); } catch (Exception e) {