根据火点编号更新审核状态

This commit is contained in:
liuchengqian 2022-06-02 11:38:55 +08:00
parent 45052a8c77
commit f978eedf58
6 changed files with 118 additions and 0 deletions

View File

@ -9,6 +9,7 @@ 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.qo.ShanDongFirePointVerifyStateQo;
import com.xkrs.model.vo.AppTaskBodyVo;
import com.xkrs.service.FirePointService;
import com.xkrs.service.StreetService;
@ -64,6 +65,18 @@ public class FirePointController {
}
}
/**
* 根据火点编号更新审核状态
* 操作1将火点编号对应的火点从山东火点表转存到火点表
* 操作2将山东火点表中的这个火点的审核状态更新
*/
@PostMapping("/updateverifystatebyfirecode")
public String updateVerifyStateByFireCode(@RequestBody ShanDongFirePointVerifyStateQo shanDongFirePointVerifyStateQo) {
String fireCode = shanDongFirePointVerifyStateQo.getFireCode();
String verifyState = shanDongFirePointVerifyStateQo.getVerifyState();
return firePointService.updateVerifyStateByFireCode(fireCode, verifyState);
}
/**
* 根据火点编码修改审核火点状态
*/

View File

@ -3,6 +3,8 @@ package com.xkrs.dao;
import com.xkrs.model.entity.ShanDongFirePointEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
@Component
@ -16,4 +18,11 @@ public interface ShanDongFirePointDao extends JpaRepository<ShanDongFirePointEnt
*/
ShanDongFirePointEntity findByFireCode(String fireCode);
/**
* 在山东临时火点表中根据火点编码修改审核状态
*/
@Modifying(clearAutomatically = true)
@Query(value = "UPDATE fire_point_shandong SET verify_state = ?2 WHERE fire_code = ?1", nativeQuery = true)
void updateVerifyStateByFireCode(String fireCode, String verifyState);
}

View File

@ -0,0 +1,38 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.ShanDongFirePointVerifyStateQoUpdate;
import javax.validation.constraints.NotNull;
public class ShanDongFirePointVerifyStateQo {
@NotNull(message = "{FirePoint.fireCode.blank}", groups = {ShanDongFirePointVerifyStateQoUpdate.class})
private String fireCode;
@NotNull(message = "{FirePoint.verifyState.blank}", groups = {ShanDongFirePointVerifyStateQoUpdate.class})
private String verifyState;
public ShanDongFirePointVerifyStateQo() {
}
public String getFireCode() {
return fireCode;
}
public void setFireCode(String fireCode) {
this.fireCode = fireCode;
}
public String getVerifyState() {
return verifyState;
}
public void setVerifyState(String verifyState) {
this.verifyState = verifyState;
}
@Override
public String toString() {
return "ShanDongFirePointVerifyStateQo{" + "fireCode='" + fireCode + '\'' + ", verifyState='" + verifyState + '\'' + '}';
}
}

View File

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

View File

@ -194,4 +194,10 @@ public interface FirePointService {
*/
String updateFirePointStreetCode();
/**
* 根据火点编号更新审核状态
* 操作1将火点编号对应的火点从山东火点表转存到火点表
* 操作2将山东火点表中的这个火点的审核状态更新
*/
String updateVerifyStateByFireCode(String fireCode, String verifyState);
}

View File

@ -199,6 +199,54 @@ public class FirePointServiceImpl implements FirePointService {
}
}
/**
* 根据火点编号更新审核状态
* 操作1将火点编号对应的火点从山东火点表转存到火点表
* 操作2将山东火点表中的这个火点的审核状态更新
*/
@Transactional(rollbackOn = Exception.class)
@Override
public String updateVerifyStateByFireCode(String fireCode, String verifyState) {
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
ShanDongFirePointEntity existShanDongFirePoint = shanDongFirePointDao.findByFireCode(fireCode);
//山东火点表找不到这个火点返回失败
if (existShanDongFirePoint == null) {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "修改失败,没有指定的火点编号", locale);
}
if ("1".equals(verifyState)) {
//火点表能找到这个火点返回失败
FirePointEntity existFirePoint = firePointDao.findByFireCode(fireCode);
if (existFirePoint != null) {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "修改失败,火点库已存在指定的火点编号", locale);
}
//完成第一步将山东火点表中的火点转存到火点表初始化为未审核状态
FirePointEntity firePointEntity = new FirePointEntity();
firePointEntity.setFireCode(existShanDongFirePoint.getFireCode());
firePointEntity.setCountyCode(existShanDongFirePoint.getCountyCode());
firePointEntity.setCountyName(existShanDongFirePoint.getCountyName());
firePointEntity.setSatelliteTime(existShanDongFirePoint.getSatelliteTime());
firePointEntity.setLongitude(existShanDongFirePoint.getLongitude());
firePointEntity.setLatitude(existShanDongFirePoint.getLatitude());
firePointEntity.setFirePointAddress(existShanDongFirePoint.getFirePointAddress());
firePointEntity.setSatelliteType(existShanDongFirePoint.getSatelliteType());
firePointEntity.setLandType(existShanDongFirePoint.getLandType());
firePointEntity.setConfidence(existShanDongFirePoint.getConfidence());
firePointEntity.setAddTime(existShanDongFirePoint.getAddTime());
firePointEntity.setFireType(existShanDongFirePoint.getFireType());
firePointEntity.setFireImage(existShanDongFirePoint.getFireImage());
firePointEntity.setSatelliteImage(existShanDongFirePoint.getSatelliteImage());
firePointEntity.setStreetCode(existShanDongFirePoint.getStreetCode());
firePointEntity.setStreetName(existShanDongFirePoint.getStreetName());
firePointEntity.setAuditFireType("0");//初始化火点为未审核状态
log.info("-------转存新火点");
firePointDao.save(firePointEntity);
}
shanDongFirePointDao.updateVerifyStateByFireCode(fireCode, verifyState);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
}
/**
* 查询今天的火点信息
*/