【修改步骤并保存仿真背景】

This commit is contained in:
weizhihong 2022-08-29 10:23:45 +08:00
parent 12dc16c0b5
commit 1e15bb8ee3

View File

@ -1,7 +1,6 @@
package club.joylink.rtss.services.training2;
import club.joylink.rtss.dao.DraftTraining2DAO;
import club.joylink.rtss.entity.TrainingWithBLOBs;
import club.joylink.rtss.entity.training2.DraftTraining2;
import club.joylink.rtss.entity.training2.DraftTraining2Example;
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
@ -23,8 +22,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import java.time.LocalDateTime;
import java.util.ArrayList;
@ -42,6 +39,7 @@ public class Training2DraftService {
private DraftTraining2DAO trainingDao;
@Autowired
private GroupSimulationService roupSimulationService;
/**
* 根据基本信息创建实训
*
@ -123,10 +121,11 @@ public class Training2DraftService {
//
this.trainingDao.updateByExampleSelective(b, example);
}
/**
* 重置用户实训草稿的初始背景
*/
public void resetTrainingBackgroud(ResetTraining2BackgroudReqVo req, Long userId){
public void resetTrainingBackgroud(ResetTraining2BackgroudReqVo req, Long userId) {
DraftTraining2Example example = new DraftTraining2Example();
example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId());
List<DraftTraining2> find = this.trainingDao.selectByExample(example);
@ -138,6 +137,7 @@ public class Training2DraftService {
//
this.trainingDao.updateByExampleSelective(b, example);
}
/**
* 更新用户实训草稿的地图定位信息
*/
@ -155,6 +155,7 @@ public class Training2DraftService {
//
this.trainingDao.updateByExampleSelective(b, example);
}
/**
* 更新当前用户的实训草稿基础信息
*/
@ -256,7 +257,7 @@ public class Training2DraftService {
//
DraftTraining2Example example = new DraftTraining2Example();
DraftTraining2Example.Criteria c = example.createCriteria().andCreatorIdEqualTo(userId);
if(null!=req.getMapId()){
if (null != req.getMapId()) {
c.andMapIdEqualTo(req.getMapId());
}
//
@ -315,11 +316,14 @@ public class Training2DraftService {
/**
* 修改实训所有步骤
*/
public void updateSteps(Long trainingId, List<Step2VO> step2VOList) {
public void updateSteps(String group, Long trainingId, List<Step2VO> step2VOList) {
DraftTraining2WithBLOBs draftTraining2 = trainingDao.selectByPrimaryKey(trainingId);
if (draftTraining2 == null) {
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在");
}
// 保存当前背景
Simulation simulation = this.roupSimulationService.getSimulationByGroup(group);
StorageSimulation scenesSaving = new StorageSimulation(simulation, false);
String stepJson;
if (CollectionUtils.isEmpty(step2VOList)) {
stepJson = StringUtil.EMPTY_STRING;