From 04b7a35a6b6292cc797c9c380b75d692d4f718e3 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 8 Sep 2022 17:32:48 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=AD=A5=E9=AA=A4=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=BF=9D=E5=AD=98=E5=87=BA=E9=94=99=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../training2/Training2DraftService.java | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/training2/Training2DraftService.java b/src/main/java/club/joylink/rtss/services/training2/Training2DraftService.java index 2303e5625..f6b1e04d8 100644 --- a/src/main/java/club/joylink/rtss/services/training2/Training2DraftService.java +++ b/src/main/java/club/joylink/rtss/services/training2/Training2DraftService.java @@ -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 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 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 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));