避免bug报错

This commit is contained in:
2025-02-16 14:51:49 +08:00
parent cfb9392068
commit ec4df2eb50
5 changed files with 54 additions and 16 deletions

View File

@ -397,14 +397,17 @@ public class GoodsServiceImpl implements GoodsService {
@Override
public ApiResponse<GoodsDetailVO> sourceGoodsInfo(Long userId, Long sourceId) {
SourceRespVO sourceRespVO = sourceMapper.listUserOne(userId, sourceId);
// if (sourceRespVO == null) {
// return ApiResponse.fail("该视频不属于你");
// }
if (sourceRespVO == null) {
sourceRespVO = sourceMapper.getById(sourceId);
if (sourceRespVO == null) {
return ApiResponse.fail("该视频不存在");
}
}
GoodsDetailVO goodsDetailVO = new GoodsDetailVO();
goodsDetailVO.setGoodsName("原片");
goodsDetailVO.setScenicId(sourceRespVO.getScenicId());
goodsDetailVO.setScenicName(sourceRespVO.getScenicName());
goodsDetailVO.setGoodsType(0);
goodsDetailVO.setGoodsType(sourceRespVO.getType());
goodsDetailVO.setGoodsId(sourceRespVO.getId());
goodsDetailVO.setVideoUrl(sourceRespVO.getVideoUrl());
goodsDetailVO.setTemplateCoverUrl(sourceRespVO.getUrl());

View File

@ -89,20 +89,12 @@ public class WxPayServiceImpl implements WxPayService {
@Autowired
private WechatConfig wechatConfig;
@Autowired
private HttpService httpService;
@Autowired
private OrderService orderService;
@Autowired
private PaymentMapper paymentMapper;
@Autowired
private StatisticsMapper statisticsMapper;
@Autowired
private OrderMapper orderMapper;
@Autowired
private SourceMapper sourceMapper;
@Autowired
private VideoMapper videoMapper;
@Autowired
private OrderRepository orderRepository;
@Autowired
private OrderBiz orderBiz;

View File

@ -252,6 +252,7 @@ public class TaskTaskServiceImpl implements TaskService {
DeviceEntity device = deviceRepository.getDevice(item.getDeviceId());
return Integer.valueOf(1).equals(device.getStatus());
})
.filter(item -> item.getDeviceId() != null) // 添加对 deviceId 为 null 的检查
.collect(Collectors.groupingBy(item -> item.getDeviceId().toString()));
if (sourcesMap.isEmpty()) {
// 主动禁止没有视频源视频生成
@ -437,14 +438,17 @@ public class TaskTaskServiceImpl implements TaskService {
return;
}
List<SourceEntity> videoSourceList = sourceMapper.listVideoByScenicFaceRelation(face.getScenicId(), faceId);
if (videoSourceList == null || videoSourceList.isEmpty()) {
log.info("task callback: 没有视频源");
return;
}
Map<String, List<SourceEntity>> sourcesMap = videoSourceList.stream()
.filter(Objects::nonNull)
.filter(item -> Objects.nonNull(item.getVideoUrl()))
.peek(item -> item.setUrl(item.getVideoUrl()))
.filter(item -> {
DeviceEntity device = deviceRepository.getDevice(item.getDeviceId());
return Integer.valueOf(1).equals(device.getStatus());
})
.filter(item -> item.getDeviceId() != null) // 添加对 deviceId 为 null 的检查
.collect(Collectors.groupingBy(item -> item.getDeviceId().toString()));
if (sourcesMap.isEmpty()) {
// 主动禁止没有视频源视频生成