From edd224b12bf3514533796e2da89be3af0d8361f5 Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期三, 20 七月 2022 10:19:16 +0800
Subject: [PATCH] 优化
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
index 402f563..31ca00f 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
@@ -169,10 +169,13 @@
}
public Map<String, Object> pushToLed(Long planId, List<NovaPushResultVO> nova) {
- if(nova==null){
+ if (nova == null) {
throw new BusinessException("璇烽�夋嫨姝g‘鐨凩ED灞�");
}
PushToLed pushToLed = playPlanMapper.pushToLed(planId);
+ if (pushToLed.getPages() == null) {
+ throw new BusinessException("鑺傜洰鍐呭涓㈠け");
+ }
PlayPlanNv byId = getById(planId);
if (pushToLed == null) {
throw new BusinessException("鏈壘鍒拌鎾斁璁″垝");
@@ -186,8 +189,26 @@
program.setPlayerIds(playerIds);
//鑾峰彇鑺傜洰瀹炰綋
- program.setPages(JSON.parseObject(pushToLed.getPages(), List.class));
+
+ List<ProgramDto> programDtos = JSON.parseArray(pushToLed.getPages(), ProgramDto.class);
+ programDtos.forEach(
+ programDto -> {
+ programDto.getWidgets().forEach(
+ widget -> {
+ String url = widget.getUrl();
+ LEDProgramFile one = fileService.getOne(Wrappers.lambdaQuery(LEDProgramFile.class).eq(LEDProgramFile::getFileUrl, url));
+ if (one == null) {
+ throw new BusinessException("鑺傜洰鏂囦欢宸插け鏁�");
+ }
+ widget.setMd5(one.getMd5());
+ widget.setSize(one.getSize());
+ }
+ );
+ }
+ );
+
+ program.setPages(programDtos);
//鑾峰彇鑺傜洰瀹氭椂瀹炰綋
program.setSchedule((JSON.parseObject(pushToLed.getSchedule(), Map.class)));
@@ -392,6 +413,9 @@
if (ledProgram == null) {
throw new BusinessException("鏈壘鍒拌妭鐩�");
}
+ if (ledProgram.getPages() == null) {
+ throw new BusinessException("鑺傜洰鍐呭涓㈠け");
+ }
if (SecurityUtils.getClientId() != null && !Objects.equals(ledProgram.getClientId(), SecurityUtils.getUserId()) && !Objects.equals(ledProgram.getClientId(), SecurityUtils.getClientId())) {
throw new BusinessException("璇蜂笉瑕佹搷浣滃叾浠栦汉鐨勮妭鐩�");
}
--
Gitblit v1.9.3