|
|
@@ -7,6 +7,9 @@ import cn.hutool.core.date.DatePattern;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
@@ -40,7 +43,6 @@ import org.dromara.common.core.utils.StreamUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
-import org.dromara.common.redis.utils.RedisUtils;
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
import org.dromara.workflow.common.constant.FlowConstant;
|
|
|
import org.dromara.workflow.common.enums.MessageTypeEnum;
|
|
|
@@ -87,17 +89,15 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
public class SmsbItemPushServiceImpl implements ISmsbItemPushService {
|
|
|
-
|
|
|
- private final static String PUSH_CONTENT_INFO_KEY = "global:msr:device:push:";
|
|
|
-
|
|
|
private final SmsbItemPushMapper baseMapper;
|
|
|
- private final SmsbItemPushTimeMapper itemPushTimeMapper;
|
|
|
private final SmsbItemPushRelMapper itemPushRelMapper;
|
|
|
private final SmsbItemFileRelMapper itemFileRelMapper;
|
|
|
private final SmsbItemSplitScreenMapper itemSplitScreenMapper;
|
|
|
private final SmsbItemMapper itemMapper;
|
|
|
private final SmsbItemPushPlaylistMapper smsbItemPushPlaylistMapper;
|
|
|
private final SmsbItemPushPlaylineMapper smsbItemPushPlaylineMapper;
|
|
|
+ private final SmsbItemProgramMapper smsbItemProgramMapper;
|
|
|
+ private final SmsbMinioDataMapper smsbMinioDataMapper;
|
|
|
@Autowired
|
|
|
private ISmsbDeviceService smsbDeviceService;
|
|
|
@Autowired
|
|
|
@@ -141,12 +141,16 @@ public class SmsbItemPushServiceImpl implements ISmsbItemPushService {
|
|
|
// 根据pushId查询所有设备信息
|
|
|
List<SmsbDeviceVo> deviceList = smsbDeviceMapper.queryDeviceVoByPushId(pushId);
|
|
|
reviewVo.setDeviceList(deviceList);
|
|
|
- // 根据pushId查询所有节目资源信息
|
|
|
+ // 根据pushId查询所有节目资源信息 轮播组+分屏组OLD
|
|
|
if (itemPushVo.getItemType() == 1L || itemPushVo.getItemType() == 2L) {
|
|
|
List<SmsbMinioDataVo> sourceList = itemFileRelMapper.selectMinioDataByPushId(pushId);
|
|
|
reviewVo.setResourceList(sourceList);
|
|
|
}
|
|
|
-
|
|
|
+ // 解析可视化json获取轮播组ID,获取文件列表
|
|
|
+ if (itemPushVo.getItemType() == 3L) {
|
|
|
+ List<SmsbMinioDataVo> sourceList = getSourceListByProgram(itemPushVo,reviewVo);
|
|
|
+ reviewVo.setResourceList(sourceList);
|
|
|
+ }
|
|
|
List<SmsbItemPushPlaylistVo> pushPlaylistVos = smsbItemPushPlaylistMapper.selectVoList(new LambdaQueryWrapper<SmsbItemPushPlaylist>()
|
|
|
.eq(SmsbItemPushPlaylist::getPushId, pushId));
|
|
|
String dateStart = pushPlaylistVos.get(0).getStartDate();
|
|
|
@@ -163,6 +167,38 @@ public class SmsbItemPushServiceImpl implements ISmsbItemPushService {
|
|
|
return reviewVo;
|
|
|
}
|
|
|
|
|
|
+ private List<SmsbMinioDataVo> getSourceListByProgram(SmsbItemPushVo itemPushVo,SmsbItemPushReviewVo reviewVo) {
|
|
|
+ List<SmsbMinioDataVo> result = new ArrayList<>();
|
|
|
+ SmsbItemProgramVo smsbItemProgram = smsbItemProgramMapper.selectVoByPushId(itemPushVo.getId());
|
|
|
+ if (null == smsbItemProgram) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ String itemJsonStr = smsbItemProgram.getItemJsonStr();
|
|
|
+ if (StringUtils.isEmpty(itemJsonStr)) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ // 解析可视化数据,获取轮播组ID
|
|
|
+ try {
|
|
|
+ JSONObject itemJson = JSONUtil.parseObj(itemJsonStr);
|
|
|
+ JSONArray elements = itemJson.getJSONArray("elements");
|
|
|
+ for (Object elementObj : elements) {
|
|
|
+ JSONObject element = JSONUtil.parseObj(elementObj);
|
|
|
+ String type = element.getStr("type");
|
|
|
+ // 类型是一个媒资
|
|
|
+ if (type.equals("mediaAsset")) {
|
|
|
+ JSONObject mediaId = JSONUtil.parseObj(element.getStr("mediaId"));
|
|
|
+ String itemId = mediaId.getStr("id");
|
|
|
+ // 根据itemId 查询资源列表
|
|
|
+ result = smsbMinioDataMapper.selectVoListByItemId(Long.parseLong(itemId));
|
|
|
+ reviewVo.setProgramId(smsbItemProgram.getProgramId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e) {
|
|
|
+ log.error("解析可视化布局JSON异常!");
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 分页查询内容发布列表
|
|
|
*
|
|
|
@@ -257,7 +293,7 @@ public class SmsbItemPushServiceImpl implements ISmsbItemPushService {
|
|
|
// 保存设备内容播放单
|
|
|
saveItemPushPlaylist(bo);
|
|
|
// 轮播组 分屏组关联保存
|
|
|
- if (bo.getItemType() == 1 || bo.getItemType() == 2) {
|
|
|
+ if (bo.getItemType() == 1 || bo.getItemType() == 2 || bo.getItemType() == 3) {
|
|
|
addItemPushRel(bo.getId(), bo.getItemIds());
|
|
|
}
|
|
|
// 下架超过播单结束时间的旧播单
|