Commit d878bb97 authored by suhuiguang's avatar suhuiguang

1.修改getone为findone

parent c8dd8bb4
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import com.yeejoin.amos.fas.business.bo.BindPointBo; import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.dao.mapper.PatrolMapper; import com.yeejoin.amos.fas.business.dao.mapper.PatrolMapper;
...@@ -97,8 +98,9 @@ public class View3dServiceImpl implements IView3dService { ...@@ -97,8 +98,9 @@ public class View3dServiceImpl implements IView3dService {
} }
public void updateFireCarPosition(BindPointBo pointBo) { public void updateFireCarPosition(BindPointBo pointBo) {
FireCar fireCar = iFireCarDao.getOne(pointBo.getPointId()); Optional<FireCar> data = iFireCarDao.findById(pointBo.getPointId());
if(fireCar != null){ if(data.isPresent()){
FireCar fireCar = data.get();
fireCar.setUe4Location(pointBo.getUe4Location()); fireCar.setUe4Location(pointBo.getUe4Location());
fireCar.setUe4Rotation(pointBo.getUe4Rotation()); fireCar.setUe4Rotation(pointBo.getUe4Rotation());
iFireCarDao.save(fireCar); iFireCarDao.save(fireCar);
...@@ -106,8 +108,9 @@ public class View3dServiceImpl implements IView3dService { ...@@ -106,8 +108,9 @@ public class View3dServiceImpl implements IView3dService {
} }
public void updateWaterSourcePosition(BindPointBo pointBo) { public void updateWaterSourcePosition(BindPointBo pointBo) {
WaterResource waterResource = iWaterResourceDao.getOne(pointBo.getPointId()); Optional<WaterResource> data = iWaterResourceDao.findById(pointBo.getPointId());
if(waterResource != null){ if(data.isPresent()){
WaterResource waterResource = data.get();
waterResource.setUe4Location(pointBo.getUe4Location()); waterResource.setUe4Location(pointBo.getUe4Location());
waterResource.setUe4Rotation(pointBo.getUe4Rotation()); waterResource.setUe4Rotation(pointBo.getUe4Rotation());
iWaterResourceDao.save(waterResource); iWaterResourceDao.save(waterResource);
...@@ -115,8 +118,9 @@ public class View3dServiceImpl implements IView3dService { ...@@ -115,8 +118,9 @@ public class View3dServiceImpl implements IView3dService {
} }
public void updateFireStationPosition(BindPointBo pointBo) { public void updateFireStationPosition(BindPointBo pointBo) {
FireStation fireStation = iFireStationDao.getOne(pointBo.getPointId()); Optional<FireStation> data = iFireStationDao.findById(pointBo.getPointId());
if(fireStation != null){ if(data.isPresent()){
FireStation fireStation = data.get();
fireStation.setUe4Location(pointBo.getUe4Location()); fireStation.setUe4Location(pointBo.getUe4Location());
fireStation.setUe4Rotation(pointBo.getUe4Rotation()); fireStation.setUe4Rotation(pointBo.getUe4Rotation());
iFireStationDao.save(fireStation); iFireStationDao.save(fireStation);
...@@ -124,8 +128,9 @@ public class View3dServiceImpl implements IView3dService { ...@@ -124,8 +128,9 @@ public class View3dServiceImpl implements IView3dService {
} }
public void updateFireEquipmentPosition(BindPointBo pointBo) { public void updateFireEquipmentPosition(BindPointBo pointBo) {
FireEquipment fireEquipment = iFireEquipmentDao.getOne(pointBo.getPointId()); Optional<FireEquipment> data = iFireEquipmentDao.findById(pointBo.getPointId());
if(fireEquipment != null){ if(data.isPresent()){
FireEquipment fireEquipment = data.get();
fireEquipment.setUe4Location(pointBo.getUe4Location()); fireEquipment.setUe4Location(pointBo.getUe4Location());
fireEquipment.setUe4Rotation(pointBo.getUe4Rotation()); fireEquipment.setUe4Rotation(pointBo.getUe4Rotation());
iFireEquipmentDao.save(fireEquipment); iFireEquipmentDao.save(fireEquipment);
...@@ -133,11 +138,14 @@ public class View3dServiceImpl implements IView3dService { ...@@ -133,11 +138,14 @@ public class View3dServiceImpl implements IView3dService {
} }
public void updateEquipmentPosition(BindPointBo pointBo) { public void updateEquipmentPosition(BindPointBo pointBo) {
Equipment equipment = iEquipmentDao.getOne(pointBo.getPointId()); Optional<Equipment> data=iEquipmentDao.findById(pointBo.getPointId());
if(equipment != null){ Equipment equipment = null;
if(data.isPresent()){
equipment = data.get();
equipment.setUe4Location(pointBo.getUe4Location()); equipment.setUe4Location(pointBo.getUe4Location());
equipment.setUe4Rotation(pointBo.getUe4Rotation()); equipment.setUe4Rotation(pointBo.getUe4Rotation());
iEquipmentDao.save(equipment); iEquipmentDao.save(equipment);
iEquipmentDao.findById(pointBo.getPointId()).get();
} }
} }
...@@ -146,8 +154,9 @@ public class View3dServiceImpl implements IView3dService { ...@@ -146,8 +154,9 @@ public class View3dServiceImpl implements IView3dService {
} }
public void updateRiskSourcePosition(BindPointBo pointBo) { public void updateRiskSourcePosition(BindPointBo pointBo) {
RiskSource riskSource = iRiskSourceDao.getOne(pointBo.getPointId()); Optional<RiskSource> data = iRiskSourceDao.findById(pointBo.getPointId());
if(riskSource != null){ if(data.isPresent()){
RiskSource riskSource = data.get();
riskSource.setUe4Location(pointBo.getUe4Location()); riskSource.setUe4Location(pointBo.getUe4Location());
riskSource.setUe4Rotation(pointBo.getUe4Rotation()); riskSource.setUe4Rotation(pointBo.getUe4Rotation());
iRiskSourceDao.save(riskSource); iRiskSourceDao.save(riskSource);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment