【步骤为空时,保存出错】
This commit is contained in:
parent
8ff182e6e7
commit
04b7a35a6b
@ -144,11 +144,12 @@ public class Training2DraftService {
|
||||
//
|
||||
this.trainingDao.updateByExampleSelective(b, example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置用户实训草稿
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void resetTraining(Long trainingId,Long userId){
|
||||
public void resetTraining(Long trainingId, Long userId) {
|
||||
DraftTraining2Example example = new DraftTraining2Example();
|
||||
example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(trainingId);
|
||||
List<DraftTraining2> find = this.trainingDao.selectByExample(example);
|
||||
@ -169,6 +170,7 @@ public class Training2DraftService {
|
||||
//
|
||||
this.trainingDao.updateByExampleSelective(b, example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户实训草稿的地图定位信息
|
||||
*/
|
||||
@ -354,24 +356,23 @@ public class Training2DraftService {
|
||||
}
|
||||
// 保存当前背景
|
||||
Simulation simulation = this.roupSimulationService.getSimulationByGroup(group);
|
||||
|
||||
String stepJson;
|
||||
if (CollectionUtils.isEmpty(step2VOList)) {
|
||||
stepJson = StringUtil.EMPTY_STRING;
|
||||
} else {
|
||||
stepJson = JsonUtils.writeValueAsString(step2VOList);
|
||||
}
|
||||
// 扮演者集合
|
||||
List<String> playerList = step2VOList.stream().
|
||||
filter(s -> !StringUtils.isEmpty(s.getMemberId())).map(s -> s.getMemberId())
|
||||
.distinct().collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(playerList)) {
|
||||
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "错误数据:无扮演者");
|
||||
}
|
||||
DraftTraining2WithBLOBs updateObj = new DraftTraining2WithBLOBs();
|
||||
updateObj.setId(trainingId);
|
||||
updateObj.setStepJson(stepJson);
|
||||
updateObj.setPlayerIdJson(JsonUtils.writeValueAsString(playerList));
|
||||
String stepJson;
|
||||
if (CollectionUtils.isEmpty(step2VOList)) {
|
||||
updateObj.setStepJson(StringUtil.EMPTY_STRING);
|
||||
} else {
|
||||
stepJson = JsonUtils.writeValueAsString(step2VOList);
|
||||
// 扮演者集合
|
||||
List<String> playerList = step2VOList.stream().
|
||||
filter(s -> !StringUtils.isEmpty(s.getMemberId())).map(s -> s.getMemberId())
|
||||
.distinct().collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(playerList)) {
|
||||
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "错误数据:无扮演者");
|
||||
}
|
||||
updateObj.setPlayerIdJson(JsonUtils.writeValueAsString(playerList));
|
||||
updateObj.setStepJson(stepJson);
|
||||
}
|
||||
// 背景
|
||||
StorageSimulation scenesSaving = new StorageSimulation(simulation, false);
|
||||
updateObj.setFinalScenesJson(JsonUtils.writeValueAsString(scenesSaving));
|
||||
|
Loading…
Reference in New Issue
Block a user