【实训操作保存时,生成操作ID】
This commit is contained in:
parent
f0bbb332c0
commit
d544413f50
@ -30,6 +30,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -104,6 +105,7 @@ public class Training2DraftService {
|
|||||||
List<DraftTraining2> find = this.trainingDao.selectByExample(example);
|
List<DraftTraining2> find = this.trainingDao.selectByExample(example);
|
||||||
return null != find && !find.isEmpty();
|
return null != find && !find.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public DraftTraining2 findById(Long id) {
|
public DraftTraining2 findById(Long id) {
|
||||||
DraftTraining2Example example = new DraftTraining2Example();
|
DraftTraining2Example example = new DraftTraining2Example();
|
||||||
@ -111,6 +113,7 @@ public class Training2DraftService {
|
|||||||
List<DraftTraining2> find = this.trainingDao.selectByExample(example);
|
List<DraftTraining2> find = this.trainingDao.selectByExample(example);
|
||||||
return null != find && find.size() > 0 ? find.get(0) : null;
|
return null != find && find.size() > 0 ? find.get(0) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新用户实训草稿的初始背景
|
* 更新用户实训草稿的初始背景
|
||||||
*/
|
*/
|
||||||
@ -360,6 +363,12 @@ public class Training2DraftService {
|
|||||||
if (draftTraining2 == null) {
|
if (draftTraining2 == null) {
|
||||||
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在");
|
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在");
|
||||||
}
|
}
|
||||||
|
AtomicInteger operationId = new AtomicInteger(0); // 操作ID
|
||||||
|
// 设置Operation的Id
|
||||||
|
step2VOList.stream().filter(s -> !CollectionUtils.isEmpty(s.getOperations())).forEach(s -> {
|
||||||
|
operationId.set(0);
|
||||||
|
s.getOperations().forEach(o -> o.setId(operationId.getAndIncrement()));
|
||||||
|
});
|
||||||
// 保存当前背景
|
// 保存当前背景
|
||||||
Simulation simulation = this.roupSimulationService.getSimulationByGroup(group);
|
Simulation simulation = this.roupSimulationService.getSimulationByGroup(group);
|
||||||
DraftTraining2WithBLOBs updateObj = new DraftTraining2WithBLOBs();
|
DraftTraining2WithBLOBs updateObj = new DraftTraining2WithBLOBs();
|
||||||
|
Loading…
Reference in New Issue
Block a user