修改审核火点状态

This commit is contained in:
liuchengqian 2022-06-02 10:53:48 +08:00
parent c1d7e65756
commit 45052a8c77
7 changed files with 92 additions and 23 deletions

View File

@ -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);
}
/**
* 更新火点的街道编号数据
*

View File

@ -62,9 +62,18 @@ public interface FirePointDao extends JpaRepository<FirePointEntity, Long>, 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<FirePointEntity, Long>, JpaS
@Modifying(clearAutomatically = true)
@Query(value = "UPDATE fire_point SET street_code = ?2 WHERE id = ?1", nativeQuery = true)
void updateStreetCodeById(Integer id, String streetCode);
}

View File

@ -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 + '\'' + '}';
}
}

View File

@ -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 + '\'' + '}';
}
}

View File

@ -0,0 +1,4 @@
package com.xkrs.model.validation;
public interface AuditFireTypeQoUpdate {
}

View File

@ -82,7 +82,6 @@ public interface FirePointService {
*/
List<FirePointEntity> selectFirePointByStreet(String streetCode, String satelliteType, String landType, String startTime, String endTime);
/**
* 根据火点编码修改火点的状态预警
*
@ -194,4 +193,5 @@ public interface FirePointService {
* @return
*/
String updateFirePointStreetCode();
}

View File

@ -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) {