Commit 008c9d5b authored by liqin's avatar liqin 💬

bug fixed

parent 0e99e11c
...@@ -9,6 +9,7 @@ import cn.wisenergy.chnmuseum.party.model.*; ...@@ -9,6 +9,7 @@ import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*; import cn.wisenergy.chnmuseum.party.service.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -21,6 +22,8 @@ import org.springframework.stereotype.Service; ...@@ -21,6 +22,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* <pre> * <pre>
...@@ -58,6 +61,12 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -58,6 +61,12 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
@Resource @Resource
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService; private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@Resource
private AuditService auditService;
@Resource
private AssetService assetService;
@Override @Override
public Page<Audit> getUserList(Page<Audit> page, TUser user) { public Page<Audit> getUserList(Page<Audit> page, TUser user) {
return page.setRecords(auditMapper.getUserList(page, user)); return page.setRecords(auditMapper.getUserList(page, user));
...@@ -246,20 +255,43 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -246,20 +255,43 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
update = this.videoContentService.updateById(videoContent); update = this.videoContentService.updateById(videoContent);
break; break;
case REMOVE: case REMOVE:
this.auditMapper.delete(Wrappers.<Audit>lambdaUpdate().eq(Audit::getRefItemId, videoContentId)); final LambdaQueryWrapper<ExhibitionBoard> queryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getVideoContentId, videoContentId).select(ExhibitionBoard::getId);
final LambdaQueryWrapper<ExhibitionBoard> queryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getVideoContentId, videoContentId); final List<String> exhibitionBoardIdList = this.exhibitionBoardService.listObjs(queryWrapper, Object::toString);
queryWrapper.select(ExhibitionBoard::getId); if (exhibitionBoardIdList != null && !exhibitionBoardIdList.isEmpty()) {
final List<String> ExhibitionBoardIdList = this.exhibitionBoardService.listObjs(queryWrapper, Object::toString); this.exhibitionBoardService.removeByIds(exhibitionBoardIdList);
this.exhibitionBoardService.removeByIds(ExhibitionBoardIdList); this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, exhibitionBoardIdList));
this.assetService.remove(Wrappers.<Asset>lambdaUpdate().in(Asset::getRefItemId, exhibitionBoardIdList));
final LambdaQueryWrapper<LearningContentBoard> learningContentBoardLambdaQueryWrapper = Wrappers.<LearningContentBoard>lambdaQuery().in(LearningContentBoard::getExhibitionBoardCatId, exhibitionBoardIdList);
final List<LearningContentBoard> learningContentBoardList = this.learningContentBoardService.list(learningContentBoardLambdaQueryWrapper);
if (learningContentBoardList != null && !learningContentBoardList.isEmpty()) {
final Map<String, List<String>> collect = learningContentBoardList.stream().collect(Collectors.groupingBy(LearningContentBoard::getLearningContentId, Collectors.mapping(LearningContentBoard::getExhibitionBoardId, Collectors.toList())));
collect.forEach((k, v) -> {
if (v.size() == 1) {
this.learningContentService.removeById(k);
this.learningContentBoardService.remove(Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, k));
this.learningContentBoardCatService.remove(Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getLearningContentId, k));
this.learningContentCopyrightOwnerService.remove(Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, k));
}
});
LambdaUpdateWrapper<LearningContentBoard> deleteWrapper1 = Wrappers.<LearningContentBoard>lambdaUpdate().in(LearningContentBoard::getExhibitionBoardId, exhibitionBoardIdList);
this.learningContentBoardService.remove(deleteWrapper1);
}
}
this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, videoContentId));
this.assetService.remove(Wrappers.<Asset>lambdaUpdate().in(Asset::getRefItemId, videoContentId));
update = this.videoContentService.removeById(videoContentId); update = this.videoContentService.removeById(videoContentId);
break; break;
case ADD: case ADD:
videoContent.setPublished(true); videoContent.setPublished(true);
update = this.videoContentService.updateById(videoContent);; update = this.videoContentService.updateById(videoContent);
;
break; break;
case EDIT: case EDIT:
videoContent.setPublished(true); videoContent.setPublished(true);
update = this.videoContentService.updateById(videoContent);; update = this.videoContentService.updateById(videoContent);
;
break; break;
default: default:
} }
...@@ -292,19 +324,32 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -292,19 +324,32 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
update = this.exhibitionBoardService.updateById(exhibitionBoard); update = this.exhibitionBoardService.updateById(exhibitionBoard);
break; break;
case REMOVE: case REMOVE:
final LambdaQueryWrapper<LearningContentBoard> learningContentBoardLambdaQueryWrapper = Wrappers.<LearningContentBoard>lambdaQuery().eq(LearningContentBoard::getExhibitionBoardCatId, exhibitionBoardId);
final List<LearningContentBoard> learningContentBoardList = this.learningContentBoardService.list(learningContentBoardLambdaQueryWrapper);
if (learningContentBoardList != null && !learningContentBoardList.isEmpty()) {
final Map<String, List<String>> collect = learningContentBoardList.stream().collect(Collectors.groupingBy(LearningContentBoard::getLearningContentId, Collectors.mapping(LearningContentBoard::getExhibitionBoardId, Collectors.toList())));
collect.forEach((k, v) -> {
if (v.size() == 1) {
this.learningContentService.removeById(k);
this.learningContentBoardService.remove(Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, k));
this.learningContentBoardCatService.remove(Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getLearningContentId, k));
this.learningContentCopyrightOwnerService.remove(Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, k));
}
});
LambdaUpdateWrapper<LearningContentBoard> learningContentBoardLambdaUpdateWrapper = Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getExhibitionBoardId, exhibitionBoardId);
this.learningContentBoardService.remove(learningContentBoardLambdaUpdateWrapper);
}
this.auditMapper.delete(Wrappers.<Audit>lambdaUpdate().eq(Audit::getRefItemId, exhibitionBoardId)); this.auditMapper.delete(Wrappers.<Audit>lambdaUpdate().eq(Audit::getRefItemId, exhibitionBoardId));
this.learningContentBoardService.remove(Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getExhibitionBoardId, exhibitionBoard.getId())); this.assetService.remove(Wrappers.<Asset>lambdaUpdate().eq(Asset::getRefItemId, exhibitionBoardId));
update = this.exhibitionBoardService.removeById(exhibitionBoardId); update = this.exhibitionBoardService.removeById(exhibitionBoardId);
break; break;
case ADD: case ADD:
exhibitionBoard.setPublished(true); exhibitionBoard.setPublished(true);
update = this.exhibitionBoardService.updateById(exhibitionBoard);; update = this.exhibitionBoardService.updateById(exhibitionBoard);
break; break;
case EDIT: case EDIT:
exhibitionBoard.setPublished(true); exhibitionBoard.setPublished(true);
update = this.exhibitionBoardService.updateById(exhibitionBoard);; update = this.exhibitionBoardService.updateById(exhibitionBoard);
break; break;
default: default:
} }
......
...@@ -67,6 +67,10 @@ public class CopyrightOwnerController extends BaseController { ...@@ -67,6 +67,10 @@ public class CopyrightOwnerController extends BaseController {
private LearningContentBoardService learningContentBoardService; private LearningContentBoardService learningContentBoardService;
@Resource @Resource
private LearningContentBoardCatService learningContentBoardCatService; private LearningContentBoardCatService learningContentBoardCatService;
@Resource
private AuditService auditService;
@Resource
private AssetService assetService;
@PostMapping("/save") @PostMapping("/save")
@RequiresAuthentication //@RequiresPermissions("copyright:owner:save") @RequiresAuthentication //@RequiresPermissions("copyright:owner:save")
...@@ -287,25 +291,73 @@ public class CopyrightOwnerController extends BaseController { ...@@ -287,25 +291,73 @@ public class CopyrightOwnerController extends BaseController {
public Map<String, Object> deleteCopyrightOwner(@PathVariable("id") String id) { public Map<String, Object> deleteCopyrightOwner(@PathVariable("id") String id) {
this.copyrightOwnerService.removeById(id); this.copyrightOwnerService.removeById(id);
final LambdaUpdateWrapper<VideoContent> updateWrapper = Wrappers.<VideoContent>lambdaUpdate().eq(VideoContent::getVideoContentCopyrightOwnerId, id); LambdaUpdateWrapper<CopyrightOwnerBoardCat> copyrightOwnerBoardCatLambdaUpdateWrapper = Wrappers.<CopyrightOwnerBoardCat>lambdaUpdate().eq(CopyrightOwnerBoardCat::getCopyrightOwnerId, id);
updateWrapper.set(VideoContent::getDeleted, true); this.copyrightOwnerBoardCatService.remove(copyrightOwnerBoardCatLambdaUpdateWrapper);
this.videoContentService.update(updateWrapper);
LambdaUpdateWrapper<CopyrightOwnerVideoContentCat> copyrightOwnerVideoContentCatLambdaUpdateWrapper = Wrappers.<CopyrightOwnerVideoContentCat>lambdaUpdate().eq(CopyrightOwnerVideoContentCat::getCopyrightOwnerId, id);
this.copyrightOwnerVideoContentCatService.remove(copyrightOwnerVideoContentCatLambdaUpdateWrapper);
final LambdaUpdateWrapper<ExhibitionBoard> updateWrapper1 = Wrappers.<ExhibitionBoard>lambdaUpdate().eq(ExhibitionBoard::getBoardCopyrightOwnerId, id); final LambdaQueryWrapper<VideoContent> videoContentLambdaQueryWrapper = Wrappers.<VideoContent>lambdaQuery().eq(VideoContent::getVideoContentCopyrightOwnerId, id).select(VideoContent::getId);
updateWrapper1.set(ExhibitionBoard::getDeleted, true); final List<String> videoContentIdList = this.videoContentService.listObjs(videoContentLambdaQueryWrapper, Object::toString);
this.exhibitionBoardService.update(updateWrapper1); if (videoContentIdList != null && !videoContentIdList.isEmpty()) {
this.videoContentService.removeByIds(videoContentIdList);
this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, videoContentIdList));
this.assetService.remove(Wrappers.<Asset>lambdaUpdate().in(Asset::getRefItemId, videoContentIdList));
LambdaUpdateWrapper<CopyrightOwnerBoardCat> deleteWrapper = Wrappers.<CopyrightOwnerBoardCat>lambdaUpdate().eq(CopyrightOwnerBoardCat::getCopyrightOwnerId, id); final LambdaQueryWrapper<ExhibitionBoard> exhibitionBoardLambdaQueryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().in(ExhibitionBoard::getVideoContentId, videoContentIdList).select(ExhibitionBoard::getId);
this.copyrightOwnerBoardCatService.remove(deleteWrapper); final List<String> ExhibitionBoardIdList = this.exhibitionBoardService.listObjs(exhibitionBoardLambdaQueryWrapper, Object::toString);
if (ExhibitionBoardIdList != null && !ExhibitionBoardIdList.isEmpty()) {
this.exhibitionBoardService.removeByIds(ExhibitionBoardIdList);
this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, ExhibitionBoardIdList));
this.assetService.remove(Wrappers.<Asset>lambdaUpdate().in(Asset::getRefItemId, ExhibitionBoardIdList));
LambdaUpdateWrapper<CopyrightOwnerVideoContentCat> deleteWrapper1 = Wrappers.<CopyrightOwnerVideoContentCat>lambdaUpdate().eq(CopyrightOwnerVideoContentCat::getCopyrightOwnerId, id); final LambdaQueryWrapper<LearningContentBoard> learningContentBoardLambdaQueryWrapper = Wrappers.<LearningContentBoard>lambdaQuery().in(LearningContentBoard::getExhibitionBoardCatId, ExhibitionBoardIdList);
this.copyrightOwnerVideoContentCatService.remove(deleteWrapper1); final List<LearningContentBoard> learningContentBoardList = this.learningContentBoardService.list(learningContentBoardLambdaQueryWrapper);
if (learningContentBoardList != null && !learningContentBoardList.isEmpty()) {
final Map<String, List<String>> collect = learningContentBoardList.stream().collect(Collectors.groupingBy(LearningContentBoard::getLearningContentId, Collectors.mapping(LearningContentBoard::getExhibitionBoardId, Collectors.toList())));
collect.forEach((k, v) -> {
if (v.size() == 1) {
this.learningContentService.removeById(k);
this.learningContentBoardService.remove(Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, k));
this.learningContentBoardCatService.remove(Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getLearningContentId, k));
this.learningContentCopyrightOwnerService.remove(Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, k));
}
});
LambdaUpdateWrapper<LearningContentBoard> deleteWrapper1 = Wrappers.<LearningContentBoard>lambdaUpdate().in(LearningContentBoard::getExhibitionBoardId, ExhibitionBoardIdList);
this.learningContentBoardService.remove(deleteWrapper1);
}
}
}
final LambdaQueryWrapper<ExhibitionBoard> exhibitionBoardLambdaQueryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getBoardCopyrightOwnerId, id).select(ExhibitionBoard::getId);
final List<String> exhibitionBoardIdList = this.exhibitionBoardService.listObjs(exhibitionBoardLambdaQueryWrapper, Object::toString);
if (exhibitionBoardIdList != null && !exhibitionBoardIdList.isEmpty()) {
this.exhibitionBoardService.removeByIds(exhibitionBoardIdList);
this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, exhibitionBoardIdList));
this.assetService.remove(Wrappers.<Asset>lambdaUpdate().in(Asset::getRefItemId, exhibitionBoardIdList));
final LambdaQueryWrapper<LearningContentBoard> learningContentBoardLambdaQueryWrapper = Wrappers.<LearningContentBoard>lambdaQuery().in(LearningContentBoard::getExhibitionBoardCatId, exhibitionBoardIdList);
final List<LearningContentBoard> learningContentBoardList = this.learningContentBoardService.list(learningContentBoardLambdaQueryWrapper);
if (learningContentBoardList != null && !learningContentBoardList.isEmpty()) {
final Map<String, List<String>> collect = learningContentBoardList.stream().collect(Collectors.groupingBy(LearningContentBoard::getLearningContentId, Collectors.mapping(LearningContentBoard::getExhibitionBoardId, Collectors.toList())));
collect.forEach((k, v) -> {
if (v.size() == 1) {
this.learningContentService.removeById(k);
this.learningContentBoardService.remove(Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, k));
this.learningContentBoardCatService.remove(Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getLearningContentId, k));
this.learningContentCopyrightOwnerService.remove(Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, k));
}
});
LambdaUpdateWrapper<LearningContentBoard> learningContentBoardLambdaUpdateWrapper = Wrappers.<LearningContentBoard>lambdaUpdate().in(LearningContentBoard::getExhibitionBoardId, exhibitionBoardIdList);
this.learningContentBoardService.remove(learningContentBoardLambdaUpdateWrapper);
}
}
final LambdaQueryWrapper<LearningContentCopyrightOwner> learningContentCopyrightOwnerLambdaQueryWrapper = Wrappers.<LearningContentCopyrightOwner>lambdaQuery().eq(LearningContentCopyrightOwner::getCopyrightOwnerId, id); final LambdaQueryWrapper<LearningContentCopyrightOwner> learningContentCopyrightOwnerLambdaQueryWrapper = Wrappers.<LearningContentCopyrightOwner>lambdaQuery().eq(LearningContentCopyrightOwner::getCopyrightOwnerId, id);
final List<LearningContentCopyrightOwner> learningContentCopyrightOwnerList = this.learningContentCopyrightOwnerService.list(learningContentCopyrightOwnerLambdaQueryWrapper); final List<LearningContentCopyrightOwner> learningContentCopyrightOwnerList = this.learningContentCopyrightOwnerService.list(learningContentCopyrightOwnerLambdaQueryWrapper);
if (learningContentCopyrightOwnerList != null && !learningContentCopyrightOwnerList.isEmpty()) { if (learningContentCopyrightOwnerList != null && !learningContentCopyrightOwnerList.isEmpty()) {
final Map<String, List<String>> collect = learningContentCopyrightOwnerList.stream().collect(Collectors.groupingBy(LearningContentCopyrightOwner::getLearningContentId, Collectors.mapping(LearningContentCopyrightOwner::getCopyrightOwnerId, Collectors.toList()))); final Map<String, List<String>> collect = learningContentCopyrightOwnerList.stream().collect(Collectors.groupingBy(LearningContentCopyrightOwner::getLearningContentId, Collectors.mapping(LearningContentCopyrightOwner::getCopyrightOwnerId, Collectors.toList())));
collect.forEach((k , v) -> { collect.forEach((k, v) -> {
if (v.size() == 1) { if (v.size() == 1) {
this.learningContentService.removeById(k); this.learningContentService.removeById(k);
this.learningContentBoardService.remove(Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, k)); this.learningContentBoardService.remove(Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, k));
...@@ -313,9 +365,8 @@ public class CopyrightOwnerController extends BaseController { ...@@ -313,9 +365,8 @@ public class CopyrightOwnerController extends BaseController {
this.learningContentCopyrightOwnerService.remove(Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, k)); this.learningContentCopyrightOwnerService.remove(Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, k));
} }
}); });
LambdaUpdateWrapper<LearningContentCopyrightOwner> learningContentCopyrightOwnerLambdaUpdateWrapper = Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getCopyrightOwnerId, id);
LambdaUpdateWrapper<LearningContentCopyrightOwner> deleteWrapper2 = Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getCopyrightOwnerId, id); this.learningContentCopyrightOwnerService.remove(learningContentCopyrightOwnerLambdaUpdateWrapper);
this.learningContentCopyrightOwnerService.remove(deleteWrapper2);
} }
return getSuccessResult(); return getSuccessResult();
......
...@@ -65,6 +65,8 @@ public class ExhibitionBoardCatController extends BaseController { ...@@ -65,6 +65,8 @@ public class ExhibitionBoardCatController extends BaseController {
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService; private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@Resource @Resource
private AuditService auditService; private AuditService auditService;
@Resource
private AssetService assetService;
@PostMapping("/save") @PostMapping("/save")
@RequiresAuthentication //@RequiresPermissions("exhibition:board:cat:save") @RequiresAuthentication //@RequiresPermissions("exhibition:board:cat:save")
...@@ -204,21 +206,33 @@ public class ExhibitionBoardCatController extends BaseController { ...@@ -204,21 +206,33 @@ public class ExhibitionBoardCatController extends BaseController {
public Map<String, Object> deleteExhibitionBoardCat(@PathVariable("id") String id) { public Map<String, Object> deleteExhibitionBoardCat(@PathVariable("id") String id) {
this.exhibitionBoardCatService.removeById(id); this.exhibitionBoardCatService.removeById(id);
final LambdaQueryWrapper<ExhibitionBoard> lambdaQueryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getExhibitionBoardCatId, id).select(ExhibitionBoard::getId); LambdaUpdateWrapper<CopyrightOwnerBoardCat> copyrightOwnerBoardCatLambdaUpdateWrapper = Wrappers.<CopyrightOwnerBoardCat>lambdaUpdate().eq(CopyrightOwnerBoardCat::getBoardCatId, id);
final List<String> exhibitionBoardIdList = this.exhibitionBoardService.listObjs(lambdaQueryWrapper, Object::toString); this.copyrightOwnerBoardCatService.remove(copyrightOwnerBoardCatLambdaUpdateWrapper);
final LambdaQueryWrapper<ExhibitionBoard> exhibitionBoardLambdaQueryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getExhibitionBoardCatId, id).select(ExhibitionBoard::getId);
final List<String> exhibitionBoardIdList = this.exhibitionBoardService.listObjs(exhibitionBoardLambdaQueryWrapper, Object::toString);
if (exhibitionBoardIdList != null && !exhibitionBoardIdList.isEmpty()) { if (exhibitionBoardIdList != null && !exhibitionBoardIdList.isEmpty()) {
final LambdaUpdateWrapper<ExhibitionBoard> updateWrapper = Wrappers.<ExhibitionBoard>lambdaUpdate().eq(ExhibitionBoard::getExhibitionBoardCatId, id); this.exhibitionBoardService.removeByIds(exhibitionBoardIdList);
updateWrapper.set(ExhibitionBoard::getDeleted, true);
this.exhibitionBoardService.update(updateWrapper);
this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, exhibitionBoardIdList)); this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, exhibitionBoardIdList));
this.assetService.remove(Wrappers.<Asset>lambdaUpdate().in(Asset::getRefItemId, exhibitionBoardIdList));
LambdaUpdateWrapper<LearningContentBoard> deleteWrapper3 = Wrappers.<LearningContentBoard>lambdaUpdate().in(LearningContentBoard::getExhibitionBoardId, exhibitionBoardIdList); final LambdaQueryWrapper<LearningContentBoard> learningContentBoardLambdaQueryWrapper = Wrappers.<LearningContentBoard>lambdaQuery().in(LearningContentBoard::getExhibitionBoardCatId, exhibitionBoardIdList);
this.learningContentBoardService.remove(deleteWrapper3); final List<LearningContentBoard> learningContentBoardList = this.learningContentBoardService.list(learningContentBoardLambdaQueryWrapper);
if (learningContentBoardList != null && !learningContentBoardList.isEmpty()) {
final Map<String, List<String>> collect = learningContentBoardList.stream().collect(Collectors.groupingBy(LearningContentBoard::getLearningContentId, Collectors.mapping(LearningContentBoard::getExhibitionBoardId, Collectors.toList())));
collect.forEach((k, v) -> {
if (v.size() == 1) {
this.learningContentService.removeById(k);
this.learningContentBoardService.remove(Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, k));
this.learningContentBoardCatService.remove(Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getLearningContentId, k));
this.learningContentCopyrightOwnerService.remove(Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, k));
}
});
LambdaUpdateWrapper<LearningContentBoard> learningContentBoardLambdaUpdateWrapper = Wrappers.<LearningContentBoard>lambdaUpdate().in(LearningContentBoard::getExhibitionBoardId, exhibitionBoardIdList);
this.learningContentBoardService.remove(learningContentBoardLambdaUpdateWrapper);
}
} }
LambdaUpdateWrapper<CopyrightOwnerBoardCat> deleteWrapper = Wrappers.<CopyrightOwnerBoardCat>lambdaUpdate().eq(CopyrightOwnerBoardCat::getBoardCatId, id);
this.copyrightOwnerBoardCatService.remove(deleteWrapper);
final LambdaQueryWrapper<LearningContentBoardCat> learningContentBoardCatLambdaQueryWrapper = Wrappers.<LearningContentBoardCat>lambdaQuery().eq(LearningContentBoardCat::getExhibitionBoardCatId, id); final LambdaQueryWrapper<LearningContentBoardCat> learningContentBoardCatLambdaQueryWrapper = Wrappers.<LearningContentBoardCat>lambdaQuery().eq(LearningContentBoardCat::getExhibitionBoardCatId, id);
final List<LearningContentBoardCat> learningContentBoardCatList = this.learningContentBoardCatService.list(learningContentBoardCatLambdaQueryWrapper); final List<LearningContentBoardCat> learningContentBoardCatList = this.learningContentBoardCatService.list(learningContentBoardCatLambdaQueryWrapper);
if (learningContentBoardCatList != null && !learningContentBoardCatList.isEmpty()) { if (learningContentBoardCatList != null && !learningContentBoardCatList.isEmpty()) {
...@@ -232,13 +246,10 @@ public class ExhibitionBoardCatController extends BaseController { ...@@ -232,13 +246,10 @@ public class ExhibitionBoardCatController extends BaseController {
} }
}); });
LambdaUpdateWrapper<LearningContentBoardCat> deleteWrapper1 = Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getExhibitionBoardCatId, id); LambdaUpdateWrapper<LearningContentBoardCat> learningContentBoardCatLambdaUpdateWrapper = Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getExhibitionBoardCatId, id);
this.learningContentBoardCatService.remove(deleteWrapper1); this.learningContentBoardCatService.remove(learningContentBoardCatLambdaUpdateWrapper);
} }
LambdaUpdateWrapper<LearningContentBoard> deleteWrapper2 = Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getExhibitionBoardCatId, id);
this.learningContentBoardService.remove(deleteWrapper2);
// final LambdaUpdateWrapper<VideoContent> updateWrapper = Wrappers.<VideoContent>lambdaUpdate().eq(VideoContent::getVideoContentCopyrightOwnerId, id); // final LambdaUpdateWrapper<VideoContent> updateWrapper = Wrappers.<VideoContent>lambdaUpdate().eq(VideoContent::getVideoContentCopyrightOwnerId, id);
// updateWrapper.set(VideoContent::getDeleted, true); // updateWrapper.set(VideoContent::getDeleted, true);
// this.videoContentService.update(updateWrapper); // this.videoContentService.update(updateWrapper);
......
...@@ -125,6 +125,7 @@ public class FileUploadController extends BaseController { ...@@ -125,6 +125,7 @@ public class FileUploadController extends BaseController {
} }
String extName = FilenameUtils.getExtension(originalFilename); String extName = FilenameUtils.getExtension(originalFilename);
String baseName = FilenameUtils.getBaseName(originalFilename);
String finalExtName = extName; String finalExtName = extName;
boolean anyMatch = Arrays.stream(DATUM_TYPE).anyMatch(s -> Objects.equals(s, finalExtName.toUpperCase())); boolean anyMatch = Arrays.stream(DATUM_TYPE).anyMatch(s -> Objects.equals(s, finalExtName.toUpperCase()));
if (anyMatch) { if (anyMatch) {
...@@ -138,15 +139,39 @@ public class FileUploadController extends BaseController { ...@@ -138,15 +139,39 @@ public class FileUploadController extends BaseController {
.fileCat(FileCatEnum.EXHIBITION_BOARD_DATUM.name()) .fileCat(FileCatEnum.EXHIBITION_BOARD_DATUM.name())
.build(); .build();
String fileUrl = null; String language = null;
final Set<MetaData> metaDataSet = new HashSet<>(); final Set<MetaData> metaDataSet = new HashSet<>();
metaDataSet.add(new MetaData("fileName", originalFilename)); metaDataSet.add(new MetaData("fileName", originalFilename));
if (originalFilename.contains("汉语")) {
metaDataSet.add(new MetaData("language", LanguageEnum.ZH.name()));
language = LanguageEnum.ZH.name();
} else if (originalFilename.contains("英语")) {
metaDataSet.add(new MetaData("language", LanguageEnum.EN.name()));
language = LanguageEnum.EN.name();
} else if (originalFilename.contains("蒙语")) {
metaDataSet.add(new MetaData("language", LanguageEnum.MN.name()));
language = LanguageEnum.MN.name();
} else if (originalFilename.contains("藏语")) {
metaDataSet.add(new MetaData("language", LanguageEnum.BO.name()));
language = LanguageEnum.BO.name();
} else if (originalFilename.contains("维吾尔语")) {
metaDataSet.add(new MetaData("language", LanguageEnum.UYG.name()));
language = LanguageEnum.UYG.name();
}
String fileUrl = null;
String fileUrlCrypto = null;
if (Arrays.stream(VIDEO_TYPE).anyMatch(s -> Objects.equals(s, finalExtName.toUpperCase()))) { if (Arrays.stream(VIDEO_TYPE).anyMatch(s -> Objects.equals(s, finalExtName.toUpperCase()))) {
metaDataSet.add(new MetaData("fileType", FileTypeEnum.VIDEO.name())); metaDataSet.add(new MetaData("fileType", FileTypeEnum.VIDEO.name()));
handleResult.setFileType(FileTypeEnum.VIDEO.name()); handleResult.setFileType(FileTypeEnum.VIDEO.name());
asset.setFileType(FileTypeEnum.VIDEO.name()); asset.setFileType(FileTypeEnum.VIDEO.name());
fileUrl = FastDFSUtils.uploadVideo(file.getInputStream(), file.getSize(), originalFilename, metaDataSet);
final Set<MetaData> fileMetaData = FastDFSUtils.getFileMetaData(fileUrl); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
IOUtils.copy(file.getInputStream(), byteArrayOutputStream);
fileUrl = FastDFSUtils.uploadVideo(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), file.getSize(), originalFilename, metaDataSet);
metaDataSet.add(new MetaData("fileName", baseName + ".chnmuseum"));
fileUrlCrypto = FastDFSUtils.uploadVideo(VideoEncryptUtil.encrypt(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), VideoEncryptUtil.cipher), file.getSize(), baseName + ".chnmuseum", metaDataSet);
final Set<MetaData> fileMetaData = FastDFSUtils.getFileMetaData(fileUrlCrypto);
String md5 = fileMetaData.stream().filter(x -> "MD5".equals(x.getName())).map(MetaData::getValue).findFirst().get(); String md5 = fileMetaData.stream().filter(x -> "MD5".equals(x.getName())).map(MetaData::getValue).findFirst().get();
asset.setMd5(md5); asset.setMd5(md5);
} else if (Arrays.stream(AUDIO_TYPE).anyMatch(s -> Objects.equals(s, finalExtName.toUpperCase()))) { } else if (Arrays.stream(AUDIO_TYPE).anyMatch(s -> Objects.equals(s, finalExtName.toUpperCase()))) {
...@@ -166,24 +191,6 @@ public class FileUploadController extends BaseController { ...@@ -166,24 +191,6 @@ public class FileUploadController extends BaseController {
asset.setFileType(FileTypeEnum.DOCUMENT.name()); asset.setFileType(FileTypeEnum.DOCUMENT.name());
fileUrl = FastDFSUtils.uploadFile(file.getInputStream(), file.getSize(), originalFilename, metaDataSet); fileUrl = FastDFSUtils.uploadFile(file.getInputStream(), file.getSize(), originalFilename, metaDataSet);
} }
String language = null;
if (originalFilename.contains("汉语")) {
metaDataSet.add(new MetaData("language", LanguageEnum.ZH.name()));
language = LanguageEnum.ZH.name();
} else if (originalFilename.contains("英语")) {
metaDataSet.add(new MetaData("language", LanguageEnum.EN.name()));
language = LanguageEnum.EN.name();
} else if (originalFilename.contains("蒙语")) {
metaDataSet.add(new MetaData("language", LanguageEnum.MN.name()));
language = LanguageEnum.MN.name();
} else if (originalFilename.contains("藏语")) {
metaDataSet.add(new MetaData("language", LanguageEnum.BO.name()));
language = LanguageEnum.BO.name();
} else if (originalFilename.contains("维吾尔语")) {
metaDataSet.add(new MetaData("language", LanguageEnum.UYG.name()));
language = LanguageEnum.UYG.name();
}
final FileInfo fileInfo = FastDFSUtils.getFileInfo(fileUrl); final FileInfo fileInfo = FastDFSUtils.getFileInfo(fileUrl);
final int crc32 = fileInfo.getCrc32(); final int crc32 = fileInfo.getCrc32();
final Asset one = this.assetService.getOne(Wrappers.<Asset>lambdaQuery().eq(Asset::getCrc32, (long) crc32).last(" limit 1")); final Asset one = this.assetService.getOne(Wrappers.<Asset>lambdaQuery().eq(Asset::getCrc32, (long) crc32).last(" limit 1"));
...@@ -191,6 +198,7 @@ public class FileUploadController extends BaseController { ...@@ -191,6 +198,7 @@ public class FileUploadController extends BaseController {
final LocalDateTime createTime = TimeUtils.getDateTimeOfTimestamp(fileInfo.getCreateTime() * 1000); final LocalDateTime createTime = TimeUtils.getDateTimeOfTimestamp(fileInfo.getCreateTime() * 1000);
asset.setFileSize(fileInfo.getFileSize()); asset.setFileSize(fileInfo.getFileSize());
asset.setFileUrl(fileUrl); asset.setFileUrl(fileUrl);
asset.setFileUrlCrypto(fileUrlCrypto);
asset.setFileCat(FileCatEnum.EXHIBITION_BOARD_DATUM.name()); asset.setFileCat(FileCatEnum.EXHIBITION_BOARD_DATUM.name());
asset.setLanguage(language); asset.setLanguage(language);
asset.setCrc32((long) crc32); asset.setCrc32((long) crc32);
...@@ -198,7 +206,9 @@ public class FileUploadController extends BaseController { ...@@ -198,7 +206,9 @@ public class FileUploadController extends BaseController {
asset.setUpdateTime(createTime); asset.setUpdateTime(createTime);
if (one != null) { if (one != null) {
FastDFSUtils.deleteFile(fileUrl); FastDFSUtils.deleteFile(fileUrl);
FastDFSUtils.deleteFile(fileUrlCrypto);
asset.setFileUrl(one.getFileUrl()); asset.setFileUrl(one.getFileUrl());
asset.setFileUrlCrypto(one.getFileUrlCrypto());
} }
this.assetService.save(asset); this.assetService.save(asset);
datumUrlList.add(asset); datumUrlList.add(asset);
...@@ -560,7 +570,7 @@ public class FileUploadController extends BaseController { ...@@ -560,7 +570,7 @@ public class FileUploadController extends BaseController {
FastDFSUtils.deleteFile(fileUrl); FastDFSUtils.deleteFile(fileUrl);
FastDFSUtils.deleteFile(fileUrlCrypto); FastDFSUtils.deleteFile(fileUrlCrypto);
asset.setFileUrl(one.getFileUrl()); asset.setFileUrl(one.getFileUrl());
asset.setFileUrlCrypto(one.getFileUrl()); asset.setFileUrlCrypto(one.getFileUrlCrypto());
} }
this.assetService.save(asset); this.assetService.save(asset);
fileList.add(asset); fileList.add(asset);
......
...@@ -63,6 +63,8 @@ public class VideoContentCatController extends BaseController { ...@@ -63,6 +63,8 @@ public class VideoContentCatController extends BaseController {
private LearningContentService learningContentService; private LearningContentService learningContentService;
@Resource @Resource
private AuditService auditService; private AuditService auditService;
@Resource
private AssetService assetService;
@PostMapping(value = "/save") @PostMapping(value = "/save")
@RequiresAuthentication //@RequiresPermissions("video:content:cat:save") @RequiresAuthentication //@RequiresPermissions("video:content:cat:save")
...@@ -178,21 +180,24 @@ public class VideoContentCatController extends BaseController { ...@@ -178,21 +180,24 @@ public class VideoContentCatController extends BaseController {
public Map<String, Object> deleteVideoContentCat(@PathVariable("id") String id) { public Map<String, Object> deleteVideoContentCat(@PathVariable("id") String id) {
this.videoContentCatService.removeById(id); this.videoContentCatService.removeById(id);
final LambdaUpdateWrapper<CopyrightOwnerVideoContentCat> updateWrapper1 = Wrappers.<CopyrightOwnerVideoContentCat>lambdaUpdate().eq(CopyrightOwnerVideoContentCat::getVideoContentCatId, id);
this.copyrightOwnerVideoContentCatService.remove(updateWrapper1);
final LambdaQueryWrapper<VideoContent> lambdaQueryWrapper = Wrappers.<VideoContent>lambdaQuery().eq(VideoContent::getVideoContentCatId, id).select(VideoContent::getId); final LambdaQueryWrapper<VideoContent> lambdaQueryWrapper = Wrappers.<VideoContent>lambdaQuery().eq(VideoContent::getVideoContentCatId, id).select(VideoContent::getId);
final List<String> videoContentIdList = this.videoContentService.listObjs(lambdaQueryWrapper, Object::toString); final List<String> videoContentIdList = this.videoContentService.listObjs(lambdaQueryWrapper, Object::toString);
if (videoContentIdList != null && !videoContentIdList.isEmpty()) { if (videoContentIdList != null && !videoContentIdList.isEmpty()) {
final LambdaUpdateWrapper<VideoContent> updateWrapper = Wrappers.<VideoContent>lambdaUpdate().eq(VideoContent::getVideoContentCatId, id); this.videoContentService.removeByIds(videoContentIdList);
updateWrapper.set(VideoContent::getDeleted, true);
this.videoContentService.update(updateWrapper);
this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, videoContentIdList)); this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, videoContentIdList));
this.assetService.remove(Wrappers.<Asset>lambdaUpdate().in(Asset::getRefItemId, videoContentIdList));
final LambdaQueryWrapper<ExhibitionBoard> queryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().in(ExhibitionBoard::getVideoContentId, videoContentIdList).select(ExhibitionBoard::getId); final LambdaQueryWrapper<ExhibitionBoard> queryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().in(ExhibitionBoard::getVideoContentId, videoContentIdList).select(ExhibitionBoard::getId);
final List<String> ExhibitionBoardIdList = this.exhibitionBoardService.listObjs(queryWrapper, Object::toString); final List<String> exhibitionBoardIdList = this.exhibitionBoardService.listObjs(queryWrapper, Object::toString);
if (ExhibitionBoardIdList != null && !ExhibitionBoardIdList.isEmpty()) { if (exhibitionBoardIdList != null && !exhibitionBoardIdList.isEmpty()) {
this.exhibitionBoardService.removeByIds(ExhibitionBoardIdList); this.exhibitionBoardService.removeByIds(exhibitionBoardIdList);
this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, ExhibitionBoardIdList)); this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, exhibitionBoardIdList));
this.assetService.remove(Wrappers.<Asset>lambdaUpdate().in(Asset::getRefItemId, exhibitionBoardIdList));
final LambdaQueryWrapper<LearningContentBoard> learningContentBoardLambdaQueryWrapper = Wrappers.<LearningContentBoard>lambdaQuery().in(LearningContentBoard::getExhibitionBoardCatId, ExhibitionBoardIdList); final LambdaQueryWrapper<LearningContentBoard> learningContentBoardLambdaQueryWrapper = Wrappers.<LearningContentBoard>lambdaQuery().in(LearningContentBoard::getExhibitionBoardCatId, exhibitionBoardIdList);
final List<LearningContentBoard> learningContentBoardList = this.learningContentBoardService.list(learningContentBoardLambdaQueryWrapper); final List<LearningContentBoard> learningContentBoardList = this.learningContentBoardService.list(learningContentBoardLambdaQueryWrapper);
if (learningContentBoardList != null && !learningContentBoardList.isEmpty()) { if (learningContentBoardList != null && !learningContentBoardList.isEmpty()) {
final Map<String, List<String>> collect = learningContentBoardList.stream().collect(Collectors.groupingBy(LearningContentBoard::getLearningContentId, Collectors.mapping(LearningContentBoard::getExhibitionBoardId, Collectors.toList()))); final Map<String, List<String>> collect = learningContentBoardList.stream().collect(Collectors.groupingBy(LearningContentBoard::getLearningContentId, Collectors.mapping(LearningContentBoard::getExhibitionBoardId, Collectors.toList())));
...@@ -205,15 +210,12 @@ public class VideoContentCatController extends BaseController { ...@@ -205,15 +210,12 @@ public class VideoContentCatController extends BaseController {
} }
}); });
LambdaUpdateWrapper<LearningContentBoard> deleteWrapper1 = Wrappers.<LearningContentBoard>lambdaUpdate().in(LearningContentBoard::getExhibitionBoardId, ExhibitionBoardIdList); LambdaUpdateWrapper<LearningContentBoard> deleteWrapper1 = Wrappers.<LearningContentBoard>lambdaUpdate().in(LearningContentBoard::getExhibitionBoardId, exhibitionBoardIdList);
this.learningContentBoardService.remove(deleteWrapper1); this.learningContentBoardService.remove(deleteWrapper1);
} }
} }
} }
final LambdaUpdateWrapper<CopyrightOwnerVideoContentCat> updateWrapper1 = Wrappers.<CopyrightOwnerVideoContentCat>lambdaUpdate().eq(CopyrightOwnerVideoContentCat::getVideoContentCatId, id);
this.copyrightOwnerVideoContentCatService.remove(updateWrapper1);
// final LambdaQueryWrapper<CopyrightOwnerVideoContentCat> eq = Wrappers.<CopyrightOwnerVideoContentCat>lambdaQuery().eq(CopyrightOwnerVideoContentCat::getVideoContentCatId, id); // final LambdaQueryWrapper<CopyrightOwnerVideoContentCat> eq = Wrappers.<CopyrightOwnerVideoContentCat>lambdaQuery().eq(CopyrightOwnerVideoContentCat::getVideoContentCatId, id);
// final List<CopyrightOwnerVideoContentCat> list = this.copyrightOwnerVideoContentCatService.list(eq); // final List<CopyrightOwnerVideoContentCat> list = this.copyrightOwnerVideoContentCatService.list(eq);
// final List<String> collect = list.stream().map(CopyrightOwnerVideoContentCat::getCopyrightOwnerId).distinct().collect(Collectors.toList()); // final List<String> collect = list.stream().map(CopyrightOwnerVideoContentCat::getCopyrightOwnerId).distinct().collect(Collectors.toList());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment