You've already forked FrameTour-BE
模板支持相同机位
This commit is contained in:
@@ -55,6 +55,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -268,18 +269,22 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
}
|
||||
TaskEntity task = videoTaskRepository.getTaskById(videoRespVO.getTaskId());
|
||||
JSONObject paramJson = JSON.parseObject(task.getTaskParams());
|
||||
long deviceCount;
|
||||
AtomicInteger deviceCount = new AtomicInteger();
|
||||
goodsDetailVO.setShotTime(taskTaskService.getTaskShotDate(task.getId()));
|
||||
if (paramJson == null) {
|
||||
deviceCount = 1;
|
||||
deviceCount.set(1);
|
||||
} else {
|
||||
List<String> templatePlaceholder = templateRepository.getTemplatePlaceholder(task.getTemplateId());
|
||||
deviceCount = paramJson.keySet().stream()
|
||||
.filter(StringUtils::isNumeric)
|
||||
.filter(templatePlaceholder::contains)
|
||||
.count();
|
||||
paramJson.entrySet().stream()
|
||||
.filter(entry -> StringUtils.isNumeric(entry.getKey()))
|
||||
.forEach(entry -> {
|
||||
if (templatePlaceholder.contains(entry.getKey())) {
|
||||
deviceCount.getAndIncrement();
|
||||
templatePlaceholder.remove(entry.getKey());
|
||||
}
|
||||
});
|
||||
}
|
||||
goodsDetailVO.setLensNum((int) deviceCount);
|
||||
goodsDetailVO.setLensNum(deviceCount.get());
|
||||
return ApiResponse.success(goodsDetailVO);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user