|
@@ -246,6 +246,8 @@ public class PolyvVideoServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVi
|
|
|
if (HttpStatus.HTTP_OK != Convert.toInt(jsonObject.get("code"))){
|
|
|
throw new RuntimeException(Convert.toStr(jsonObject.get("message")));
|
|
|
}
|
|
|
+ LambdaQueryWrapper<PolyvCata> lqw = Wrappers.lambdaQuery();
|
|
|
+ iPolyvCataService.remove(lqw);
|
|
|
//将数据加入数据库
|
|
|
JSONArray jsonArray=jsonObject.getJSONArray("data");
|
|
|
List<PolyvCataData> list=jsonArray.toJavaList(PolyvCataData.class);
|
|
@@ -253,45 +255,7 @@ public class PolyvVideoServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVi
|
|
|
PolyvCataQueryBo polyvCataQueryBo = new PolyvCataQueryBo();
|
|
|
polyvCataQueryBo.setCataid(polyvCataData.getCataid());
|
|
|
List<PolyvCataVo> polyvCataVos = iPolyvCataService.queryList(polyvCataQueryBo);
|
|
|
- if (CollectionUtils.isNotEmpty(polyvCataVos)){
|
|
|
- PolyvCata polyvCata = BeanUtil.toBean(polyvCataData, PolyvCata.class);
|
|
|
- LambdaQueryWrapper<PolyvCata> lqw = Wrappers.lambdaQuery();
|
|
|
- lqw.eq( PolyvCata::getCataid, polyvCataData.getCataid());
|
|
|
- polyvCata.setUpdateTime(DateUtils.getNowTime());
|
|
|
- iPolyvCataService.update(polyvCata,lqw);
|
|
|
- List<Nodes> listOne=polyvCataData.getNodes();
|
|
|
- if (CollectionUtils.isNotEmpty(listOne)){
|
|
|
- for (Nodes cata : listOne) {
|
|
|
- PolyvCata polyvCataOne = BeanUtil.toBean(cata, PolyvCata.class);
|
|
|
- LambdaQueryWrapper<PolyvCata> lqwOne = Wrappers.lambdaQuery();
|
|
|
- lqw.eq( PolyvCata::getCataid, polyvCataData.getCataid());
|
|
|
- polyvCataOne.setUpdateTime(DateUtils.getNowTime());
|
|
|
- iPolyvCataService.update(polyvCataOne,lqwOne);
|
|
|
- List<Nodes> listTwo=cata.getNodes();
|
|
|
- if (CollectionUtils.isNotEmpty(listTwo)){
|
|
|
- for (Nodes cataTwo : listTwo) {
|
|
|
- PolyvCata polyvCataTwo = BeanUtil.toBean(cataTwo, PolyvCata.class);
|
|
|
- LambdaQueryWrapper<PolyvCata> lqwTwo = Wrappers.lambdaQuery();
|
|
|
- lqw.eq( PolyvCata::getCataid, polyvCataData.getCataid());
|
|
|
- polyvCataTwo.setUpdateTime(DateUtils.getNowTime());
|
|
|
- iPolyvCataService.update(polyvCataTwo,lqwTwo);
|
|
|
- List<Nodes> listThree=cataTwo.getNodes();
|
|
|
- if (CollectionUtils.isNotEmpty(listThree)){
|
|
|
- for (Nodes cataThree : listThree) {
|
|
|
- PolyvCata polyvCataThree = BeanUtil.toBean(cataThree, PolyvCata.class);
|
|
|
- LambdaQueryWrapper<PolyvCata> lqwThree = Wrappers.lambdaQuery();
|
|
|
- lqw.eq( PolyvCata::getCataid, polyvCataData.getCataid());
|
|
|
- polyvCataThree.setUpdateTime(DateUtils.getNowTime());
|
|
|
- iPolyvCataService.update(polyvCataThree,lqwThree);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
- }else {
|
|
|
PolyvCata polyvCata = BeanUtil.toBean(polyvCataData, PolyvCata.class);
|
|
|
polyvCata.setCreateTime(DateUtils.getNowTime());
|
|
|
polyvCata.setUpdateTime(DateUtils.getNowTime());
|
|
@@ -324,7 +288,7 @@ public class PolyvVideoServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVi
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
@@ -364,32 +328,34 @@ public class PolyvVideoServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVi
|
|
|
JSONArray jsonArray=jsonObject.getJSONArray("data");
|
|
|
Object total = jsonObject.get("total");
|
|
|
List<PolyvVideoVo> list=jsonArray.toJavaList(PolyvVideoVo.class);
|
|
|
- for (PolyvVideoVo polyvVideoVo : list) {
|
|
|
- CourseStreamingQueryBo courseStreamingQueryBo = new CourseStreamingQueryBo();
|
|
|
- courseStreamingQueryBo.setRecordingVideoId(polyvVideoVo.getVid());
|
|
|
- List<Integer> status = new ArrayList<>();
|
|
|
- status.add(1);
|
|
|
- courseStreamingQueryBo.setStatus(status);
|
|
|
- List<CourseStreamingVo> courseStreamingVos = iCourseStreamingService.selectList(courseStreamingQueryBo);
|
|
|
- if (CollectionUtils.isEmpty(courseStreamingVos)) {
|
|
|
- CourseStreaming add = new CourseStreaming();
|
|
|
- add.setCode(ServletUtils.getEncoded("L"));
|
|
|
- add.setRecordingVideoId(polyvVideoVo.getVid());
|
|
|
- add.setStreamingAddressType(bo.getStreamingAddressType());
|
|
|
- add.setStreamingName(polyvVideoVo.getTitle());
|
|
|
- add.setStreamingType(2L);
|
|
|
- add.setPlaybackUrl(polyvVideoVo.getMp4());
|
|
|
- add.setIntroduce(bo.getIntroduce());
|
|
|
- add.setStatus(1);
|
|
|
- add.setCreateTime(DateUtils.getNowTime());
|
|
|
- add.setUpdateTime(DateUtils.getNowTime());
|
|
|
- boolean result = iCourseStreamingService.save(add);
|
|
|
- if (result) {
|
|
|
- if (!CollectionUtils.isEmpty(bo.getBusinessList())) {
|
|
|
- for (int i = 0; i < bo.getBusinessList().size(); i++) {
|
|
|
- CourseStreamingBusinessAddBo item = bo.getBusinessList().get(i);
|
|
|
- item.setStreamingId(add.getId());
|
|
|
- iCourseStreamingBusinessService.insertByAddBo(item);
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ for (PolyvVideoVo polyvVideoVo : list) {
|
|
|
+ CourseStreamingQueryBo courseStreamingQueryBo = new CourseStreamingQueryBo();
|
|
|
+ courseStreamingQueryBo.setRecordingVideoId(polyvVideoVo.getVid());
|
|
|
+ List<Integer> status = new ArrayList<>();
|
|
|
+ status.add(1);
|
|
|
+ courseStreamingQueryBo.setStatus(status);
|
|
|
+ List<CourseStreamingVo> courseStreamingVos = iCourseStreamingService.selectList(courseStreamingQueryBo);
|
|
|
+ if (CollectionUtils.isEmpty(courseStreamingVos)) {
|
|
|
+ CourseStreaming add = new CourseStreaming();
|
|
|
+ add.setCode(ServletUtils.getEncoded("L"));
|
|
|
+ add.setRecordingVideoId(polyvVideoVo.getVid());
|
|
|
+ add.setStreamingAddressType(bo.getStreamingAddressType());
|
|
|
+ add.setStreamingName(polyvVideoVo.getTitle());
|
|
|
+ add.setStreamingType(2L);
|
|
|
+ add.setPlaybackUrl(polyvVideoVo.getMp4());
|
|
|
+ add.setIntroduce(bo.getIntroduce());
|
|
|
+ add.setStatus(1);
|
|
|
+ add.setCreateTime(DateUtils.getNowTime());
|
|
|
+ add.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ boolean result = iCourseStreamingService.save(add);
|
|
|
+ if (result) {
|
|
|
+ if (!CollectionUtils.isEmpty(bo.getBusinessList())) {
|
|
|
+ for (int i = 0; i < bo.getBusinessList().size(); i++) {
|
|
|
+ CourseStreamingBusinessAddBo item = bo.getBusinessList().get(i);
|
|
|
+ item.setStreamingId(add.getId());
|
|
|
+ iCourseStreamingBusinessService.insertByAddBo(item);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|