Commit dae93097 authored by jiawei's avatar jiawei

Merge branch 'dev' of http://111.203.232.171:8888/lee/chnmuseum-party

 Conflicts:
	src/main/java/cn/wisenergy/chnmuseum/party/service/impl/AuditServiceImpl.java
	src/main/java/cn/wisenergy/chnmuseum/party/web/controller/CopyrightOwnerController.java
	src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ExhibitionBoardCatController.java
	src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ExhibitionBoardController.java
	src/main/java/cn/wisenergy/chnmuseum/party/web/controller/LearningContentController.java
	src/main/java/cn/wisenergy/chnmuseum/party/web/controller/TAppVersionController.java
	src/main/java/cn/wisenergy/chnmuseum/party/web/controller/VideoContentController.java
parents 8dfd02d3 0e99e11c
......@@ -3,10 +3,10 @@ package cn.wisenergy.chnmuseum.party.common.enums;
public enum LanguageEnum {
ZH("Chinese", "汉语"),
EN("English", "英语"),
MN("Mongolian", "蒙语"),
BO("Tibetan", "藏语"),
UYG("Uyghur", "维吾尔语"),
EN("English", "英语");
UYG("Uyghur", "维吾尔语");
// 错误编码
private String code;
......
......@@ -83,10 +83,6 @@ public class Audit implements Serializable {
@TableField(value = "second_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime secondTime;
@ApiModelProperty("0:未删除,1:已删除")
@TableField("is_deleted")
private Boolean deleted;
@ApiModelProperty("初审意见")
@TableField("first_remarks")
private String firstRemarks;
......
......@@ -56,7 +56,7 @@ public class TBoxOperation implements Serializable {
@TableField("public_key")
private String publicKey;
@ApiModelProperty(hidden = true)
@ApiModelProperty("机顶盒密钥")
@TableField("private_key")
private String privateKey;
......
package cn.wisenergy.chnmuseum.party.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.wisenergy.chnmuseum.party.common.enums.*;
import cn.wisenergy.chnmuseum.party.common.enums.AuditOperationEnum;
import cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum;
import cn.wisenergy.chnmuseum.party.common.enums.AuditTypeEnum;
import cn.wisenergy.chnmuseum.party.common.mvc.InterfaceException;
import cn.wisenergy.chnmuseum.party.mapper.AuditMapper;
import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -35,12 +34,6 @@ import java.util.List;
@Service
public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements AuditService {
@Resource
private AssetService assetService;
@Resource
private AssetTmpService assetTmpService;
@Resource
private AuditMapper auditMapper;
......@@ -50,21 +43,12 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
@Resource
private VideoContentService videoContentService;
@Resource
private VideoContentTmpService videoContentTmpService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private ExhibitionBoardTmpService exhibitionBoardTmpService;
@Resource
private LearningContentService learningContentService;
@Resource
private LearningContentTmpService learningContentTmpService;
@Resource
private LearningContentBoardService learningContentBoardService;
......@@ -93,7 +77,6 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
//暂时注掉
// .eq("a.level", auditStatusLevel.name())
.eq("a.type", type.name())
.eq("a.is_deleted", 0)
// .eq("b.is_deleted", 0)
// .eq("c.is_deleted", 0)
.orderByDesc("a.create_time", "a.id");
......@@ -263,42 +246,20 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
update = this.videoContentService.updateById(videoContent);
break;
case REMOVE:
final LambdaQueryWrapper<ExhibitionBoard> queryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getVideoContentId, videoContent.getId());
this.auditMapper.delete(Wrappers.<Audit>lambdaUpdate().eq(Audit::getRefItemId, videoContentId));
final LambdaQueryWrapper<ExhibitionBoard> queryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getVideoContentId, videoContentId);
queryWrapper.select(ExhibitionBoard::getId);
final List<String> ExhibitionBoardIdList = this.exhibitionBoardService.listObjs(queryWrapper, Object::toString);
this.exhibitionBoardService.removeByIds(ExhibitionBoardIdList);
this.videoContentTmpService.removeById(videoContentId);
update = this.videoContentService.removeById(videoContentId);
break;
case ADD:
videoContent.setPublished(true);
update = this.videoContentService.updateById(videoContent);
update = this.videoContentService.updateById(videoContent);;
break;
case EDIT:
final String data = this.videoContentTmpService.getById(videoContentId).getData();
final VideoContent one = JSONObject.parseObject(data, VideoContent.class);
final List<String> videoFileIdList = one.getVideoFileIdList();
if (videoFileIdList != null && !videoFileIdList.isEmpty()) {
this.assetService.remove(Wrappers.<Asset>lambdaUpdate().eq(Asset::getRefItemId, videoContentId));
final List<AssetTmp> assetTmpList = this.assetTmpService.list(Wrappers.<AssetTmp>lambdaQuery().eq(AssetTmp::getRefItemId, videoContentId));
for (AssetTmp assetTmp : assetTmpList) {
Asset asset = new Asset();
BeanUtil.copyProperties(assetTmp, asset);
asset.setThumbnail(videoContent.getThumbnail());
asset.setFileType(FileTypeEnum.VIDEO.name());
asset.setFileCat(FileCatEnum.VIDEO_CONTENT.name());
asset.setRefItemId(videoContentId);
this.assetService.save(asset);
if (StringUtils.isBlank(one.getName())) {
videoContent.setName(asset.getVideoContentName());
}
}
}
one.setAuditStatus(audit.getStatus());
one.setPublished(true); //todo
update = this.videoContentService.updateById(one);
this.videoContentTmpService.removeById(videoContentId);
this.assetTmpService.remove(Wrappers.<AssetTmp>lambdaUpdate().eq(AssetTmp::getRefItemId, videoContentId));
videoContent.setPublished(true);
update = this.videoContentService.updateById(videoContent);;
break;
default:
}
......@@ -331,55 +292,19 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
update = this.exhibitionBoardService.updateById(exhibitionBoard);
break;
case REMOVE:
this.auditMapper.delete(Wrappers.<Audit>lambdaUpdate().eq(Audit::getRefItemId, exhibitionBoardId));
this.learningContentBoardService.remove(Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getExhibitionBoardId, exhibitionBoard.getId()));
this.exhibitionBoardTmpService.removeById(exhibitionBoardId);
update = this.exhibitionBoardService.removeById(exhibitionBoardId);
break;
case ADD:
exhibitionBoard.setPublished(true);
update = this.exhibitionBoardService.updateById(exhibitionBoard);
update = this.exhibitionBoardService.updateById(exhibitionBoard);;
break;
case EDIT:
final String data = this.exhibitionBoardTmpService.getById(exhibitionBoardId).getData();
final ExhibitionBoard one = JSONObject.parseObject(data, ExhibitionBoard.class);
final List<String> audioIdList = one.getAudioIdList();
if (audioIdList != null && !audioIdList.isEmpty()) {
final LambdaUpdateWrapper<Asset> lambdaUpdateWrapper = Wrappers.<Asset>lambdaUpdate().eq(Asset::getRefItemId, exhibitionBoardId);
lambdaUpdateWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
this.assetService.remove(lambdaUpdateWrapper);
final LambdaQueryWrapper<AssetTmp> assetTmpQueryWrapper = Wrappers.<AssetTmp>lambdaQuery().eq(AssetTmp::getRefItemId, exhibitionBoardId);
assetTmpQueryWrapper.eq(AssetTmp::getFileCat, FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
final List<AssetTmp> assetTmpList = this.assetTmpService.list(assetTmpQueryWrapper);
for (AssetTmp assetTmp : assetTmpList) {
Asset asset = new Asset();
BeanUtil.copyProperties(assetTmp, asset);
asset.setFileType(FileTypeEnum.AUDIO.name());
asset.setFileCat(FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
asset.setRefItemId(exhibitionBoardId);
this.assetService.save(asset);
}
}
final List<String> datumIdList = one.getDatumIdList();
if (datumIdList != null && !datumIdList.isEmpty()) {
final LambdaUpdateWrapper<Asset> lambdaUpdateWrapper = Wrappers.<Asset>lambdaUpdate().eq(Asset::getRefItemId, exhibitionBoardId);
lambdaUpdateWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_DATUM.name());
this.assetService.remove(lambdaUpdateWrapper);
final LambdaQueryWrapper<AssetTmp> assetTmpQueryWrapper = Wrappers.<AssetTmp>lambdaQuery().eq(AssetTmp::getRefItemId, exhibitionBoardId);
assetTmpQueryWrapper.eq(AssetTmp::getFileCat, FileCatEnum.EXHIBITION_BOARD_DATUM.name());
final List<AssetTmp> assetTmpList = this.assetTmpService.list(assetTmpQueryWrapper);
for (AssetTmp assetTmp : assetTmpList) {
Asset asset = new Asset();
BeanUtil.copyProperties(assetTmp, asset);
asset.setFileCat(FileCatEnum.EXHIBITION_BOARD_DATUM.name());
asset.setRefItemId(exhibitionBoardId);
this.assetService.save(asset);
}
}
one.setAuditStatus(audit.getStatus());
one.setPublished(true); //todo
update = this.exhibitionBoardService.updateById(one);
this.exhibitionBoardTmpService.removeById(exhibitionBoardId);
this.assetTmpService.remove(Wrappers.<AssetTmp>lambdaUpdate().eq(AssetTmp::getRefItemId, exhibitionBoardId));
exhibitionBoard.setPublished(true);
update = this.exhibitionBoardService.updateById(exhibitionBoard);;
break;
default:
}
......@@ -412,7 +337,10 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
update = this.learningContentService.updateById(learningContent);
break;
case REMOVE:
this.learningContentTmpService.removeById(learningContentId);
this.auditMapper.delete(Wrappers.<Audit>lambdaUpdate().eq(Audit::getRefItemId, learningContentId));
this.learningContentBoardService.remove(Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, learningContentId));
this.learningContentBoardCatService.remove(Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getLearningContentId, learningContentId));
this.learningContentCopyrightOwnerService.remove(Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, learningContentId));
update = this.learningContentService.removeById(learningContentId);
break;
case ADD:
......@@ -420,46 +348,8 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
update = this.learningContentService.updateById(learningContent);
break;
case EDIT:
final String data = this.learningContentTmpService.getById(learningContentId).getData();
final LearningContent one = JSONObject.parseObject(data, LearningContent.class);
final List<String> exhibitionBoardCatIdList = one.getExhibitionBoardCatIdList();
if (exhibitionBoardCatIdList != null && !exhibitionBoardCatIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentBoardCat> lambdaUpdateWrapper = Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getLearningContentId, learningContentId);
this.learningContentBoardCatService.remove(lambdaUpdateWrapper);
for (String exhibitionBoardCatId : exhibitionBoardCatIdList) {
LearningContentBoardCat learningContentBoardCat = LearningContentBoardCat.builder().exhibitionBoardCatId(exhibitionBoardCatId).learningContentId(learningContentId).build();
this.learningContentBoardCatService.save(learningContentBoardCat);
}
}
final List<String> copyrightOwnerIdList = one.getCopyrightOwnerIdList();
if (copyrightOwnerIdList != null && !copyrightOwnerIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentCopyrightOwner> lambdaUpdateWrapper = Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, learningContentId);
this.learningContentCopyrightOwnerService.remove(lambdaUpdateWrapper);
for (String copyrightOwnerId : copyrightOwnerIdList) {
LearningContentCopyrightOwner contentCopyrightOwner = LearningContentCopyrightOwner.builder().copyrightOwnerId(copyrightOwnerId).learningContentId(learningContentId).build();
this.learningContentCopyrightOwnerService.save(contentCopyrightOwner);
}
}
final List<String> exhibitionBoardIdList = one.getExhibitionBoardIdList();
if (exhibitionBoardIdList != null && !exhibitionBoardIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentBoard> lambdaUpdateWrapper = Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, learningContentId);
this.learningContentBoardService.remove(lambdaUpdateWrapper);
for (String exhibitionBoardId : exhibitionBoardIdList) {
LearningContentBoard learningContentBoard = LearningContentBoard.builder()
.learningContentId(learningContentId)
.exhibitionBoardCatId(this.exhibitionBoardService.getById(exhibitionBoardId).getExhibitionBoardCatId())
.exhibitionBoardId(exhibitionBoardId)
.build();
this.learningContentBoardService.save(learningContentBoard);
}
}
one.setAuditStatus(audit.getStatus());
one.setPublished(true); //todo
update = this.learningContentService.updateById(one);
this.learningContentTmpService.removeById(learningContentId);
learningContent.setPublished(true);
update = this.learningContentService.updateById(learningContent);
break;
default:
}
......@@ -485,7 +375,6 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
//
audit.setLevel(AuditStatusEnum.TBC.name());
audit.setStatus(AuditStatusEnum.TBC.name());
audit.setDeleted(false);
audit.setCreateTime(LocalDateTime.now());
//
Object principal = SecurityUtils.getSubject().getPrincipal();
......
......@@ -2,22 +2,22 @@ package cn.wisenergy.chnmuseum.party.service.impl;
import cn.wisenergy.chnmuseum.party.common.enums.AuditOperationEnum;
import cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum;
import cn.wisenergy.chnmuseum.party.common.util.RSAUtils;
import cn.wisenergy.chnmuseum.party.mapper.TAreaMapper;
import cn.wisenergy.chnmuseum.party.mapper.TUserMapper;
import cn.wisenergy.chnmuseum.party.model.TBoxOperation;
import cn.wisenergy.chnmuseum.party.model.TUser;
import cn.wisenergy.chnmuseum.party.mapper.TUserMapper;
import cn.wisenergy.chnmuseum.party.model.TUserRole;
import cn.wisenergy.chnmuseum.party.service.TUserService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
......@@ -74,7 +74,7 @@ public class TUserServiceImpl extends ServiceImpl<TUserMapper, TUser> implements
TUser user = tUserMapper.getById(id);
if (user.getAreaId() != null) {
String s = areaMapper.selectParent(user.getAreaId());
if (s!=null) {
if (s != null) {
user.setAreas(Arrays.asList(s.split(",")));
}
}
......@@ -83,15 +83,13 @@ public class TUserServiceImpl extends ServiceImpl<TUserMapper, TUser> implements
@Override
public List<TUser> getUserList(TUser user) {
List<TUser> list = tUserMapper.getUserList(user);
return list;
return tUserMapper.getUserList(user);
}
@Override
public boolean addBox(TUser user) {
boolean ret = false;
ret = save(user);
boolean ret;
save(user);
TBoxOperation tBoxOperation = new TBoxOperation();
tBoxOperation.setOrganId(user.getOrgId());
......@@ -99,6 +97,9 @@ public class TUserServiceImpl extends ServiceImpl<TUserMapper, TUser> implements
tBoxOperation.setStatus(1);
tBoxOperation.setCreateTime(LocalDateTime.now());
tBoxOperation.setUpdateTime(LocalDateTime.now());
final ArrayList<String> rsaKeys = RSAUtils.createRSAKeys();
tBoxOperation.setPublicKey(rsaKeys.get(0));
tBoxOperation.setPrivateKey(rsaKeys.get(1));
ret = boxOperationService.save(tBoxOperation);
TUserRole userRole = new TUserRole();
......
......@@ -143,7 +143,7 @@ public class AssetController extends BaseController {
}
@ApiOperation(value = "导出所有机顶盒的文件加密密钥", notes = "导出所有机顶盒的文件加密密钥")
@PostMapping("/downloadCipher")
@GetMapping("/downloadCipher")
@RequiresAuthentication
@MethodLog(operModule = OperModule.VIDEOREMIT, operType = OperType.VIDEO_EXPORT)
public void downloadCipher(HttpServletResponse response) throws IOException {
......
......@@ -40,10 +40,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
......@@ -330,12 +327,12 @@ public class ChinaMobileRestApiController extends BaseController {
}
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "boardId", value = "展板内容ID", paramType = "path", dataType = "String", required = true)
@ApiImplicitParam(name = "boardId", value = "展板内容ID", paramType = "query", dataType = "String", required = true)
})
@ApiOperation(value = "查询某个展板语言列表", notes = "查询某个展板语言列表")
@GetMapping(value = "/exhibitionBoard/language/{boardId}")
@GetMapping(value = "/exhibitionBoard/language")
@RequiresAuthentication
public Map<String, Object> getLanguageList(@PathVariable(value = "boardId") String boardId) {
public Map<String, Object> getLanguageList(@RequestParam(value = "boardId") String boardId) {
JSONObject resultMap = new JSONObject();
List<Map<String, String>> list = new ArrayList<>();
try {
......@@ -344,22 +341,24 @@ public class ChinaMobileRestApiController extends BaseController {
final LambdaQueryWrapper<Asset> eq = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, videoContentId);
final List<Asset> assetList = this.assetService.list(eq);
final List<String> languageList = assetList.stream().map(Asset::getLanguage).collect(Collectors.toList());
for (String language : languageList) {
Map<String, String> map = new HashMap<>(2);
map.put("code", LanguageEnum.valueOf(language).name());
map.put("name", LanguageEnum.valueOf(language).getName());
for (LanguageEnum languageEnum : LanguageEnum.values()) {
if (languageList.contains(languageEnum.name())) {
Map<String, String> map = new LinkedHashMap<>(1);
map.put("code", languageEnum.name());
map.put("name", languageEnum.getName());
list.add(map);
}
}
resultMap.put("resultCode", "200");
resultMap.put("message", "成功");
resultMap.put("data", list);
return resultMap;
} catch (Exception e) {
resultMap.put("resultCode", "500");
resultMap.put("message", "失败");
resultMap.put("message", "该展板已下架");
resultMap.put("data", "");
}
return getFailResult();
return getFailResult("该展板已下架");
}
@ApiImplicitParams(value = {
......
......@@ -47,30 +47,26 @@ public class CopyrightOwnerController extends BaseController {
@Resource
private CopyrightOwnerService copyrightOwnerService;
@Resource
private VideoContentCatService videoContentCatService;
@Resource
private VideoContentService videoContentService;
@Resource
private CopyrightOwnerVideoContentCatService copyrightOwnerVideoContentCatService;
@Resource
private CopyrightOwnerBoardCatService copyrightOwnerBoardCatService;
@Resource
private ExhibitionBoardCatService exhibitionBoardCatService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@Resource
private LearningContentService learningContentService;
@Resource
private LearningContentBoardService learningContentBoardService;
@Resource
private LearningContentBoardCatService learningContentBoardCatService;
@PostMapping("/save")
@RequiresAuthentication //@RequiresPermissions("copyright:owner:save")
......@@ -308,12 +304,18 @@ public class CopyrightOwnerController extends BaseController {
final LambdaQueryWrapper<LearningContentCopyrightOwner> learningContentCopyrightOwnerLambdaQueryWrapper = Wrappers.<LearningContentCopyrightOwner>lambdaQuery().eq(LearningContentCopyrightOwner::getCopyrightOwnerId, id);
final List<LearningContentCopyrightOwner> learningContentCopyrightOwnerList = this.learningContentCopyrightOwnerService.list(learningContentCopyrightOwnerLambdaQueryWrapper);
if (learningContentCopyrightOwnerList != null && !learningContentCopyrightOwnerList.isEmpty()) {
final Map<String, List<String>> collect = learningContentCopyrightOwnerList.stream().collect(Collectors.groupingBy(LearningContentCopyrightOwner::getLearningContentId, Collectors.mapping(LearningContentCopyrightOwner::getCopyrightOwnerId, 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<LearningContentCopyrightOwner> deleteWrapper2 = Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getCopyrightOwnerId, id);
this.learningContentCopyrightOwnerService.remove(deleteWrapper2);
if (learningContentCopyrightOwnerList.size() == 1) {
this.learningContentService.removeById(learningContentCopyrightOwnerList.get(0).getLearningContentId());
}
}
return getSuccessResult();
......
......@@ -50,8 +50,6 @@ public class ExhibitionBoardCatController extends BaseController {
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private ExhibitionBoardTmpService exhibitionBoardTmpService;
@Resource
private ExhibitionBoardCatService exhibitionBoardCatService;
@Resource
private CopyrightOwnerService copyrightOwnerService;
......@@ -63,6 +61,10 @@ public class ExhibitionBoardCatController extends BaseController {
private LearningContentService learningContentService;
@Resource
private LearningContentBoardService learningContentBoardService;
@Resource
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@Resource
private AuditService auditService;
@PostMapping("/save")
@RequiresAuthentication //@RequiresPermissions("exhibition:board:cat:save")
......@@ -202,9 +204,17 @@ public class ExhibitionBoardCatController extends BaseController {
public Map<String, Object> deleteExhibitionBoardCat(@PathVariable("id") String id) {
this.exhibitionBoardCatService.removeById(id);
final LambdaQueryWrapper<ExhibitionBoard> lambdaQueryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getExhibitionBoardCatId, id).select(ExhibitionBoard::getId);
final List<String> exhibitionBoardIdList = this.exhibitionBoardService.listObjs(lambdaQueryWrapper, Object::toString);
if (exhibitionBoardIdList != null && !exhibitionBoardIdList.isEmpty()) {
final LambdaUpdateWrapper<ExhibitionBoard> updateWrapper = Wrappers.<ExhibitionBoard>lambdaUpdate().eq(ExhibitionBoard::getExhibitionBoardCatId, id);
updateWrapper.set(ExhibitionBoard::getDeleted, true);
this.exhibitionBoardService.update(updateWrapper);
this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, exhibitionBoardIdList));
LambdaUpdateWrapper<LearningContentBoard> deleteWrapper3 = Wrappers.<LearningContentBoard>lambdaUpdate().in(LearningContentBoard::getExhibitionBoardId, exhibitionBoardIdList);
this.learningContentBoardService.remove(deleteWrapper3);
}
LambdaUpdateWrapper<CopyrightOwnerBoardCat> deleteWrapper = Wrappers.<CopyrightOwnerBoardCat>lambdaUpdate().eq(CopyrightOwnerBoardCat::getBoardCatId, id);
this.copyrightOwnerBoardCatService.remove(deleteWrapper);
......@@ -212,21 +222,23 @@ public class ExhibitionBoardCatController extends BaseController {
final LambdaQueryWrapper<LearningContentBoardCat> learningContentBoardCatLambdaQueryWrapper = Wrappers.<LearningContentBoardCat>lambdaQuery().eq(LearningContentBoardCat::getExhibitionBoardCatId, id);
final List<LearningContentBoardCat> learningContentBoardCatList = this.learningContentBoardCatService.list(learningContentBoardCatLambdaQueryWrapper);
if (learningContentBoardCatList != null && !learningContentBoardCatList.isEmpty()) {
final Map<String, List<String>> collect = learningContentBoardCatList.stream().collect(Collectors.groupingBy(LearningContentBoardCat::getLearningContentId, Collectors.mapping(LearningContentBoardCat::getExhibitionBoardCatId, 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<LearningContentBoardCat> deleteWrapper1 = Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getExhibitionBoardCatId, id);
this.learningContentBoardCatService.remove(deleteWrapper1);
if (learningContentBoardCatList.size() == 1) {
this.learningContentService.removeById(learningContentBoardCatList.get(0).getLearningContentId());
}
}
LambdaUpdateWrapper<LearningContentBoard> deleteWrapper2 = Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getExhibitionBoardCatId, id);
this.learningContentBoardService.remove(deleteWrapper2);
final LambdaQueryWrapper<ExhibitionBoard> exhibitionBoardLambdaQueryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getExhibitionBoardCatId, id).select(ExhibitionBoard::getId);
final List<String> exhibitionBoardIdList = this.exhibitionBoardService.listObjs(exhibitionBoardLambdaQueryWrapper, Object::toString);
this.exhibitionBoardTmpService.removeByIds(exhibitionBoardIdList);
// final LambdaUpdateWrapper<VideoContent> updateWrapper = Wrappers.<VideoContent>lambdaUpdate().eq(VideoContent::getVideoContentCopyrightOwnerId, id);
// updateWrapper.set(VideoContent::getDeleted, true);
// this.videoContentService.update(updateWrapper);
......
......@@ -10,7 +10,6 @@ import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -47,8 +46,6 @@ public class ExhibitionBoardController extends BaseController {
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private ExhibitionBoardTmpService exhibitionBoardTmpService;
@Resource
private ExhibitionBoardCatService exhibitionBoardCatService;
@Resource
private CopyrightOwnerService copyrightOwnerService;
......@@ -58,8 +55,6 @@ public class ExhibitionBoardController extends BaseController {
private AuditService auditService;
@Resource
private AssetService assetService;
@Resource
private AssetTmpService assetTmpService;
@PostMapping("/save")
@RequiresAuthentication //@RequiresPermissions("exhibition:board:save")
......@@ -103,7 +98,6 @@ public class ExhibitionBoardController extends BaseController {
.type(AuditTypeEnum.EXHIBITION_BOARD.name())
.operation(AuditOperationEnum.ADD.name())
.status(AuditStatusEnum.TBC.name())
.deleted(false)
.level(AuditStatusEnum.TBC.name())
.build();
this.auditService.save(audit);
......@@ -119,26 +113,58 @@ public class ExhibitionBoardController extends BaseController {
@ApiOperation(value = "修改展板信息", notes = "修改展板信息")
@MethodLog(operModule = OperModule.DISPLAYCONTENT, operType = OperType.UPDATE)
public Map<String, Object> updateExhibitionBoard(@Validated(value = {Update.class}) ExhibitionBoard exhibitionBoard) {
final boolean flag = this.exhibitionBoardTmpService.save(ExhibitionBoardTmp.builder().id(exhibitionBoard.getId()).data(JSONObject.toJSONString(exhibitionBoard)).build());
TUser user = getcurUser();
final VideoContent videoContent = this.videoContentService.getById(exhibitionBoard.getVideoContentId());
exhibitionBoard.setVideoContentName(videoContent.getName());
exhibitionBoard.setAuditStatus(AuditStatusEnum.TBC.name());
boolean flag = exhibitionBoardService.updateById(exhibitionBoard);
if (flag) {
final ExhibitionBoard one = this.exhibitionBoardService.getById(exhibitionBoard.getId());
one.setAuditStatus(AuditStatusEnum.TBC.name());
this.exhibitionBoardService.updateById(one);
final List<String> audioIdList = exhibitionBoard.getAudioIdList();
if (audioIdList != null && !audioIdList.isEmpty()) {
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
final List<Asset> assetList = this.assetService.list(assetQueryWrapper);
final Map<String, String> collect = assetList.stream().collect(Collectors.toMap(Asset::getId, Asset::getFileUrl));
for (String audioId : audioIdList) {
final Asset asset = this.assetService.getById(audioId);
asset.setFileType(FileTypeEnum.AUDIO.name());
asset.setFileCat(FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
asset.setRefItemId(exhibitionBoard.getId());
this.assetService.updateById(asset);
collect.remove(audioId);
}
collect.forEach((k, v) -> this.assetService.removeById(k));
}
final List<String> datumIdList = exhibitionBoard.getDatumIdList();
if (datumIdList != null && !datumIdList.isEmpty()) {
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_DATUM.name());
final List<Asset> assetList = this.assetService.list(assetQueryWrapper);
final Map<String, String> collect = assetList.stream().collect(Collectors.toMap(Asset::getId, Asset::getFileUrl));
for (String datumId : datumIdList) {
final Asset asset = this.assetService.getById(datumId);
asset.setFileCat(FileCatEnum.EXHIBITION_BOARD_DATUM.name());
asset.setRefItemId(exhibitionBoard.getId());
this.assetService.updateById(asset);
collect.remove(datumId);
}
collect.forEach((k, v) -> this.assetService.removeById(k));
}
final Audit audit = Audit.builder()
.content(exhibitionBoard.getName())
.refItemId(exhibitionBoard.getId())
.userId(getcurUser().getId())
.userId(user.getId())
.type(AuditTypeEnum.EXHIBITION_BOARD.name())
.operation(AuditOperationEnum.EDIT.name())
.status(AuditStatusEnum.TBC.name())
.deleted(false)
.level(AuditStatusEnum.TBC.name())
.build();
this.auditService.save(audit);
return getSuccessResult();
}
return getFailResult("提交失败!上次提交的修改申请已经在审核中");
return getFailResult();
}
@PostMapping("/getList")
......@@ -321,55 +347,6 @@ public class ExhibitionBoardController extends BaseController {
exhibitionBoard.setDatumList(datumList);
exhibitionBoard.setDatumIdList(datumList.stream().map(Asset::getId).collect(Collectors.toList()));
final String videoContentId = exhibitionBoard.getVideoContentId();
if (videoContentId != null) {
final VideoContent videoContent = this.videoContentService.getById(videoContentId);
exhibitionBoard.setVideoContentName(videoContent.getName());
assetQueryWrapper.clear();
assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, videoContentId);
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.VIDEO_CONTENT.name());
final List<Asset> videoList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setVideoList(videoList);
}
return getResult(exhibitionBoard);
}
@ApiOperation(value = "获取展板详情(审核详情使用)", notes = "获取展板详情(审核详情使用)")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "标识ID", dataType = "String", paramType = "path", required = true)
})
@GetMapping("/getAudit/{id}")
@RequiresAuthentication //@RequiresPermissions("video:content:get:id")
@MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.SELECT)
public Map<String, Object> getAuditInfoById(@PathVariable("id") String id) {
final ExhibitionBoard exhibitionBoard = JSONObject.parseObject(exhibitionBoardTmpService.getById(id).getData(), ExhibitionBoard.class);
String exhibitionBoardCatId = exhibitionBoard.getExhibitionBoardCatId();
if (exhibitionBoardCatId != null) {
exhibitionBoard.setExhibitionBoardCatName(this.exhibitionBoardCatService.getById(exhibitionBoardCatId).getName());
}
String boardCopyrightOwnerId = exhibitionBoard.getBoardCopyrightOwnerId();
if (boardCopyrightOwnerId != null) {
exhibitionBoard.setBoardCopyrightOwnerName(this.copyrightOwnerService.getById(boardCopyrightOwnerId).getName());
}
if (exhibitionBoard.getVideoContentCopyrightOwnerId() != null) {
String name = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId()).getName();
exhibitionBoard.setVideoContentCopyrightOwnerName(name);
}
LambdaQueryWrapper<AssetTmp> assetTmpQueryWrapper = Wrappers.<AssetTmp>lambdaQuery().eq(AssetTmp::getRefItemId, exhibitionBoard.getId());
assetTmpQueryWrapper.eq(AssetTmp::getFileCat, FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
final List<AssetTmp> audioTmpList = this.assetTmpService.list(assetTmpQueryWrapper);
exhibitionBoard.setAudioTmpList(audioTmpList);
exhibitionBoard.setAudioIdList(audioTmpList.stream().map(AssetTmp::getId).collect(Collectors.toList()));
assetTmpQueryWrapper.clear();
assetTmpQueryWrapper = Wrappers.<AssetTmp>lambdaQuery().eq(AssetTmp::getRefItemId, exhibitionBoard.getId());
assetTmpQueryWrapper.eq(AssetTmp::getFileCat, FileCatEnum.EXHIBITION_BOARD_DATUM.name());
final List<AssetTmp> datumTmpList = this.assetTmpService.list(assetTmpQueryWrapper);
exhibitionBoard.setDatumTmpList(datumTmpList);
exhibitionBoard.setDatumIdList(datumTmpList.stream().map(AssetTmp::getId).collect(Collectors.toList()));
final LambdaQueryWrapper<Audit> auditQueryWrapper = Wrappers.<Audit>lambdaQuery().eq(Audit::getRefItemId, id);
auditQueryWrapper.select(Audit::getContent);
auditQueryWrapper.select(Audit::getType);
......@@ -388,9 +365,10 @@ public class ExhibitionBoardController extends BaseController {
final VideoContent videoContent = this.videoContentService.getById(videoContentId);
exhibitionBoard.setVideoContentName(videoContent.getName());
final LambdaQueryWrapper<Asset> lambdaQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, videoContentId);
lambdaQueryWrapper.eq(Asset::getFileCat, FileCatEnum.VIDEO_CONTENT.name());
final List<Asset> videoList = this.assetService.list(lambdaQueryWrapper);
assetQueryWrapper.clear();
assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, videoContentId);
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.VIDEO_CONTENT.name());
final List<Asset> videoList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setVideoList(videoList);
}
return getResult(exhibitionBoard);
......@@ -413,7 +391,6 @@ public class ExhibitionBoardController extends BaseController {
.type(AuditTypeEnum.EXHIBITION_BOARD.name())
.operation(isPublish ? AuditOperationEnum.UPPER.name() : AuditOperationEnum.LOWER.name())
.status(AuditStatusEnum.TBC.name())
.deleted(false)
.level(AuditStatusEnum.TBC.name())
.build();
this.auditService.save(audit);
......@@ -437,7 +414,6 @@ public class ExhibitionBoardController extends BaseController {
.type(AuditTypeEnum.EXHIBITION_BOARD.name())
.operation(AuditOperationEnum.REMOVE.name())
.status(AuditStatusEnum.TBC.name())
.deleted(false)
.level(AuditStatusEnum.TBC.name())
.build();
final boolean result = this.auditService.save(audit);
......
......@@ -13,9 +13,9 @@ import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
......@@ -49,37 +49,24 @@ public class LearningContentController extends BaseController {
@Resource
private ExhibitionBoardCatService exhibitionBoardCatService;
@Resource
private VideoContentService videoContentService;
@Resource
private CopyrightOwnerService copyrightOwnerService;
@Resource
private LearningContentService learningContentService;
@Resource
private LearningContentTmpService learningContentTmpService;
@Resource
private LearningContentBoardCatService learningContentBoardCatService;
@Resource
private LearningContentBoardService learningContentBoardService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@Resource
private LearningProjectService learningProjectService;
@Resource
private AuditService auditService;
@Resource
private AssetService assetService;
......@@ -145,7 +132,6 @@ public class LearningContentController extends BaseController {
.userId(tUser.getId())
.operation(AuditOperationEnum.ADD.name())
.status(AuditStatusEnum.TBC.name())
.deleted(false)
.level(AuditStatusEnum.TBC.name())
.build();
this.auditService.save(audit);
......@@ -161,26 +147,64 @@ public class LearningContentController extends BaseController {
@ApiOperation(value = "修改学习内容信息", notes = "修改学习内容信息")
@MethodLog(operModule = OperModule.LEARNCONTENT, operType = OperType.UPDATE)
public Map<String, Object> updateLearningContent(@Validated(value = {Update.class}) LearningContent learningContent) {
final boolean flag = this.learningContentTmpService.save(LearningContentTmp.builder().id(learningContent.getId()).data(JSONObject.toJSONString(learningContent)).build());
if (flag) {
final LearningContent one = this.learningContentService.getById(learningContent.getId());
one.setAuditStatus(AuditStatusEnum.TBC.name());
this.learningContentService.updateById(one);
TUser user = getcurUser();
learningContent.setAuditStatus(AuditStatusEnum.TBC.name());
// 保存业务节点信息
final String learningContentId = learningContent.getId();
final List<String> exhibitionBoardCatIdList = learningContent.getExhibitionBoardCatIdList();
if (exhibitionBoardCatIdList != null && !exhibitionBoardCatIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentBoardCat> lambdaUpdateWrapper = Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getLearningContentId, learningContentId);
this.learningContentBoardCatService.remove(lambdaUpdateWrapper);
for (String exhibitionBoardCatId : exhibitionBoardCatIdList) {
LearningContentBoardCat learningContentBoardCat = LearningContentBoardCat.builder().exhibitionBoardCatId(exhibitionBoardCatId).learningContentId(learningContentId).build();
this.learningContentBoardCatService.save(learningContentBoardCat);
}
}
final List<String> copyrightOwnerIdList = learningContent.getCopyrightOwnerIdList();
if (copyrightOwnerIdList != null && !copyrightOwnerIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentCopyrightOwner> lambdaUpdateWrapper = Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, learningContentId);
this.learningContentCopyrightOwnerService.remove(lambdaUpdateWrapper);
for (String copyrightOwnerId : copyrightOwnerIdList) {
LearningContentCopyrightOwner contentCopyrightOwner = LearningContentCopyrightOwner.builder().copyrightOwnerId(copyrightOwnerId).learningContentId(learningContentId).build();
this.learningContentCopyrightOwnerService.save(contentCopyrightOwner);
}
}
final List<String> exhibitionBoardIdList = learningContent.getExhibitionBoardIdList();
if (exhibitionBoardIdList != null && !exhibitionBoardIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentBoard> lambdaUpdateWrapper = Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, learningContentId);
this.learningContentBoardService.remove(lambdaUpdateWrapper);
for (String exhibitionBoardId : exhibitionBoardIdList) {
LearningContentBoard learningContentBoard = LearningContentBoard.builder()
.learningContentId(learningContentId)
.exhibitionBoardCatId(this.exhibitionBoardService.getById(exhibitionBoardId).getExhibitionBoardCatId())
.exhibitionBoardId(exhibitionBoardId)
.build();
this.learningContentBoardService.save(learningContentBoard);
}
}
boolean flag = learningContentService.updateById(learningContent);
if (flag) {
final Audit audit = Audit.builder()
.content(learningContent.getName())
.userId(getcurUser().getId())
.userId(user.getId())
.refItemId(learningContent.getId())
.type(AuditTypeEnum.LEARNING_CONTENT.name())
.operation(AuditOperationEnum.EDIT.name())
.status(AuditStatusEnum.TBC.name())
.deleted(false)
.level(AuditStatusEnum.TBC.name())
.build();
this.auditService.save(audit);
return getSuccessResult();
}
return getFailResult("提交失败!上次提交的修改申请已经在审核中");
return getFailResult();
}
@GetMapping("/getList")
......@@ -290,8 +314,8 @@ public class LearningContentController extends BaseController {
final LambdaQueryWrapper<LearningContentBoardCat> queryWrapper = Wrappers.<LearningContentBoardCat>lambdaQuery().eq(LearningContentBoardCat::getLearningContentId, id);
queryWrapper.select(LearningContentBoardCat::getExhibitionBoardCatId);
final List<String> exhibitionBoardCatIdList = this.learningContentBoardCatService.listObjs(queryWrapper, Object::toString);
if (!exhibitionBoardCatIdList.isEmpty()) {
final List<ExhibitionBoardCat> exhibitionBoardCats = this.exhibitionBoardCatService.listByIds(exhibitionBoardCatIdList);
if (!exhibitionBoardCats.isEmpty()) {
learningContent.setExhibitionBoardCatIdList(exhibitionBoardCats.stream().map(ExhibitionBoardCat::getId).collect(Collectors.toList()));
learningContent.setExhibitionBoardCatNameList(exhibitionBoardCats.stream().map(ExhibitionBoardCat::getName).collect(Collectors.toList()));
}
......@@ -299,8 +323,8 @@ public class LearningContentController extends BaseController {
final LambdaQueryWrapper<LearningContentCopyrightOwner> queryWrapper1 = Wrappers.<LearningContentCopyrightOwner>lambdaQuery().eq(LearningContentCopyrightOwner::getLearningContentId, id);
queryWrapper1.select(LearningContentCopyrightOwner::getCopyrightOwnerId);
final List<String> copyrightOwnerIdList = this.learningContentCopyrightOwnerService.listObjs(queryWrapper1, Object::toString);
if (!copyrightOwnerIdList.isEmpty()) {
final List<CopyrightOwner> copyrightOwnerList = this.copyrightOwnerService.listByIds(copyrightOwnerIdList);
if (!copyrightOwnerList.isEmpty()) {
learningContent.setCopyrightOwnerIdList(copyrightOwnerList.stream().map(CopyrightOwner::getId).collect(Collectors.toList()));
learningContent.setCopyrightOwnerNameList(copyrightOwnerList.stream().map(CopyrightOwner::getName).collect(Collectors.toList()));
}
......@@ -358,88 +382,6 @@ public class LearningContentController extends BaseController {
}
learningContent.setExhibitionBoardList(exhibitionBoardList);
}
return getResult(learningContent);
}
@ApiOperation(value = "获取学习内容详情(审核详情使用)", notes = "获取学习内容详情(审核详情使用)")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "标识ID", dataType = "String", paramType = "path", required = true)
})
@GetMapping("/getAudit/{id}")
@RequiresAuthentication //@RequiresPermissions("video:content:get:id")
@MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.SELECT)
public Map<String, Object> getAuditInfoById(@PathVariable("id") String id) {
final LearningContent learningContent = JSONObject.parseObject(learningContentTmpService.getById(id).getData(), LearningContent.class);
LearningProject learningProject = this.learningProjectService.getById(learningContent.getLearningProjectId());
if (learningProject != null) {
learningContent.setLearningProjectName(learningProject.getName());
}
final List<String> exhibitionBoardCatIdList = learningContent.getExhibitionBoardIdList();
final List<ExhibitionBoardCat> exhibitionBoardCats = this.exhibitionBoardCatService.listByIds(exhibitionBoardCatIdList);
if (!exhibitionBoardCats.isEmpty()) {
learningContent.setExhibitionBoardCatIdList(exhibitionBoardCats.stream().map(ExhibitionBoardCat::getId).collect(Collectors.toList()));
learningContent.setExhibitionBoardCatNameList(exhibitionBoardCats.stream().map(ExhibitionBoardCat::getName).collect(Collectors.toList()));
}
final List<String> copyrightOwnerIdList = learningContent.getCopyrightOwnerIdList();
final List<CopyrightOwner> copyrightOwnerList = this.copyrightOwnerService.listByIds(copyrightOwnerIdList);
if (!copyrightOwnerList.isEmpty()) {
learningContent.setCopyrightOwnerIdList(copyrightOwnerList.stream().map(CopyrightOwner::getId).collect(Collectors.toList()));
learningContent.setCopyrightOwnerNameList(copyrightOwnerList.stream().map(CopyrightOwner::getName).collect(Collectors.toList()));
}
final List<String> exhibitionBoardIdList = learningContent.getExhibitionBoardIdList();
if (!exhibitionBoardIdList.isEmpty()) {
final List<ExhibitionBoard> exhibitionBoardList = this.exhibitionBoardService.listByIds(exhibitionBoardIdList);
if (!exhibitionBoardList.isEmpty()) {
learningContent.setExhibitionBoardIdList(exhibitionBoardList.stream().map(ExhibitionBoard::getId).collect(Collectors.toList()));
learningContent.setExhibitionBoardNameList(exhibitionBoardList.stream().map(ExhibitionBoard::getName).collect(Collectors.toList()));
}
for (ExhibitionBoard exhibitionBoard : exhibitionBoardList) {
String exhibitionBoardCatId = exhibitionBoard.getExhibitionBoardCatId();
if (exhibitionBoardCatId != null) {
exhibitionBoard.setExhibitionBoardCatName(this.exhibitionBoardCatService.getById(exhibitionBoardCatId).getName());
}
String boardCopyrightOwnerId = exhibitionBoard.getBoardCopyrightOwnerId();
if (boardCopyrightOwnerId != null) {
final CopyrightOwner copyrightOwner = this.copyrightOwnerService.getById(boardCopyrightOwnerId);
if (copyrightOwner != null) {
exhibitionBoard.setBoardCopyrightOwnerName(copyrightOwner.getName());
}
}
if (exhibitionBoard.getVideoContentCopyrightOwnerId() != null) {
String name = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId()).getName();
exhibitionBoard.setVideoContentCopyrightOwnerName(name);
}
LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
final List<Asset> audioList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setAudioList(audioList);
assetQueryWrapper.clear();
assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_DATUM.name());
final List<Asset> datumList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setDatumList(datumList);
String videoContentId = exhibitionBoard.getVideoContentId();
if (videoContentId != null) {
final VideoContent videoContent = this.videoContentService.getOne(Wrappers.<VideoContent>lambdaQuery().eq(VideoContent::getId, videoContentId));
if (videoContent != null) {
assetQueryWrapper.clear();
assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, videoContentId);
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.VIDEO_CONTENT.name());
final List<Asset> videoList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setVideoList(videoList);
exhibitionBoard.setVideoContentName(videoContent.getName());
}
}
}
learningContent.setExhibitionBoardList(exhibitionBoardList);
}
final LambdaQueryWrapper<Audit> auditQueryWrapper = Wrappers.<Audit>lambdaQuery().eq(Audit::getRefItemId, id);
auditQueryWrapper.select(Audit::getContent);
......@@ -554,7 +496,6 @@ public class LearningContentController extends BaseController {
.type(AuditTypeEnum.LEARNING_CONTENT.name())
.operation(isPublish ? AuditOperationEnum.ENABLE.name() : AuditOperationEnum.DISABLE.name())
.status(AuditStatusEnum.TBC.name())
.deleted(false)
.level(AuditStatusEnum.TBC.name())
.build();
this.auditService.save(audit);
......
......@@ -3,26 +3,25 @@ package cn.wisenergy.chnmuseum.party.web.controller;
import cn.wisenergy.chnmuseum.party.common.log.MethodLog;
import cn.wisenergy.chnmuseum.party.common.log.OperModule;
import cn.wisenergy.chnmuseum.party.common.log.OperType;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import cn.wisenergy.chnmuseum.party.model.TAppVersion;
import cn.wisenergy.chnmuseum.party.model.TUser;
import cn.wisenergy.chnmuseum.party.service.TAppVersionService;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import cn.wisenergy.chnmuseum.party.model.TAppVersion;
import cn.wisenergy.chnmuseum.party.service.TAppVersionService;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
......
package cn.wisenergy.chnmuseum.party.web.controller;
import cn.wisenergy.chnmuseum.party.auth.util.JwtTokenUtil;
import cn.wisenergy.chnmuseum.party.common.log.MethodLog;
import cn.wisenergy.chnmuseum.party.common.log.OperModule;
import cn.wisenergy.chnmuseum.party.common.log.OperType;
......@@ -19,7 +18,6 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.*;
......@@ -140,9 +138,6 @@ public class TBoxOperationController extends BaseController {
resultMap.put("message", "此mac地址已绑定账号!");
return resultMap;
}
final ArrayList<String> rsaKeys = RSAUtils.createRSAKeys();
tBoxOperation.setPublicKey(rsaKeys.get(0));
tBoxOperation.setPrivateKey(rsaKeys.get(1));
}
if (3==tBoxOperation.getStatus()) {
tBoxOperation.setMac(null);
......
......@@ -21,7 +21,6 @@ import cn.wisenergy.chnmuseum.party.service.impl.TBoxOperationServiceImpl;
import cn.wisenergy.chnmuseum.party.service.impl.TOrganServiceImpl;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -30,10 +29,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -458,7 +454,6 @@ public class TUserController extends BaseController {
audit.setType(AuditTypeEnum.ACCOUNT.name());
audit.setOperation(AuditOperationEnum.DISABLE.name());
audit.setStatus(AuditStatusEnum.TBC.name());
audit.setDeleted(false);
audit.setLevel(AuditStatusEnum.TBC.name());
audit.setCreateTime(LocalDateTime.now());
auditService.save(audit);
......
......@@ -45,18 +45,27 @@ public class VideoContentCatController extends BaseController {
@Resource
private CopyrightOwnerVideoContentCatService copyrightOwnerVideoContentCatService;
@Resource
private VideoContentCatService videoContentCatService;
@Resource
private VideoContentService videoContentService;
@Resource
private VideoContentTmpService videoContentTmpService;
@Resource
private CopyrightOwnerService copyrightOwnerService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private LearningContentBoardCatService learningContentBoardCatService;
@Resource
private LearningContentBoardService learningContentBoardService;
@Resource
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@Resource
private LearningContentService learningContentService;
@Resource
private AuditService auditService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
......@@ -175,9 +184,38 @@ public class VideoContentCatController extends BaseController {
public Map<String, Object> deleteVideoContentCat(@PathVariable("id") String id) {
this.videoContentCatService.removeById(id);
final LambdaQueryWrapper<VideoContent> lambdaQueryWrapper = Wrappers.<VideoContent>lambdaQuery().eq(VideoContent::getVideoContentCatId, id).select(VideoContent::getId);
final List<String> videoContentIdList = this.videoContentService.listObjs(lambdaQueryWrapper, Object::toString);
if (videoContentIdList != null && !videoContentIdList.isEmpty()) {
final LambdaUpdateWrapper<VideoContent> updateWrapper = Wrappers.<VideoContent>lambdaUpdate().eq(VideoContent::getVideoContentCatId, id);
updateWrapper.set(VideoContent::getDeleted, true);
this.videoContentService.update(updateWrapper);
this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::getRefItemId, videoContentIdList));
final LambdaQueryWrapper<ExhibitionBoard> queryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().in(ExhibitionBoard::getVideoContentId, videoContentIdList).select(ExhibitionBoard::getId);
final List<String> ExhibitionBoardIdList = this.exhibitionBoardService.listObjs(queryWrapper, Object::toString);
if (ExhibitionBoardIdList != null && !ExhibitionBoardIdList.isEmpty()) {
this.exhibitionBoardService.removeByIds(ExhibitionBoardIdList);
this.auditService.remove(Wrappers.<Audit>lambdaUpdate().in(Audit::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);
}
}
}
final LambdaUpdateWrapper<CopyrightOwnerVideoContentCat> updateWrapper1 = Wrappers.<CopyrightOwnerVideoContentCat>lambdaUpdate().eq(CopyrightOwnerVideoContentCat::getVideoContentCatId, id);
this.copyrightOwnerVideoContentCatService.remove(updateWrapper1);
......
......@@ -10,7 +10,6 @@ import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -45,25 +44,14 @@ public class VideoContentController extends BaseController {
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private VideoContentService videoContentService;
@Resource
private VideoContentTmpService videoContentTmpService;
@Resource
private CopyrightOwnerService copyrightOwnerService;
@Resource
private VideoContentCatService videoContentCatService;
@Resource
private AssetService assetService;
@Resource
private AssetTmpService assetTmpService;
@Resource
private AuditService auditService;
......@@ -105,7 +93,6 @@ public class VideoContentController extends BaseController {
.type(AuditTypeEnum.VIDEO_CONTENT.name())
.operation(AuditOperationEnum.ADD.name())
.status(AuditStatusEnum.TBC.name())
.deleted(false)
.level(AuditStatusEnum.TBC.name())
.build();
this.auditService.save(audit);
......@@ -119,26 +106,46 @@ public class VideoContentController extends BaseController {
@ApiOperation(value = "修改视频内容信息", notes = "修改视频内容信息")
@MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.UPDATE)
public Map<String, Object> updateVideoContent(@Validated(value = {Update.class}) VideoContent videoContent) {
final boolean flag = this.videoContentTmpService.save(VideoContentTmp.builder().id(videoContent.getId()).data(JSONObject.toJSONString(videoContent)).build());
TUser user = getcurUser();
videoContent.setAuditStatus(AuditStatusEnum.TBC.name());
boolean flag = videoContentService.updateById(videoContent);
if (flag) {
final VideoContent one = this.videoContentService.getById(videoContent.getId());
one.setAuditStatus(AuditStatusEnum.TBC.name());
this.videoContentService.updateById(one);
final List<String> videoFileIdList = videoContent.getVideoFileIdList();
if (videoFileIdList != null && !videoFileIdList.isEmpty()) {
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, videoContent.getId());
final List<Asset> assetList = this.assetService.list(assetQueryWrapper);
final Map<String, String> collect = assetList.stream().collect(Collectors.toMap(Asset::getId, Asset::getFileUrl));
for (String videoFileId : videoFileIdList) {
final Asset asset = this.assetService.getById(videoFileId);
asset.setThumbnail(videoContent.getThumbnail());
asset.setFileType(FileTypeEnum.VIDEO.name());
asset.setFileCat(FileCatEnum.VIDEO_CONTENT.name());
asset.setRefItemId(videoContent.getId());
this.assetService.updateById(asset);
if (StringUtils.isBlank(videoContent.getName())) {
videoContent.setName(asset.getVideoContentName());
this.videoContentService.updateById(videoContent);
}
collect.remove(videoFileId);
}
collect.forEach((k, v) -> this.assetService.removeById(k));
}
final Audit audit = Audit.builder()
.content(videoContent.getName())
.userId(getcurUser().getId())
.userId(user.getId())
.refItemId(videoContent.getId())
.type(AuditTypeEnum.VIDEO_CONTENT.name())
.operation(AuditOperationEnum.EDIT.name())
.status(AuditStatusEnum.TBC.name())
.deleted(false)
.level(AuditStatusEnum.TBC.name())
.build();
this.auditService.save(audit);
return getSuccessResult();
}
return getFailResult("提交失败!上次提交的修改申请已经在审核中");
return getFailResult();
}
@GetMapping("/getExhibitionBoardById/{id}")
......@@ -290,49 +297,6 @@ public class VideoContentController extends BaseController {
return getResult(videoContent);
}
@ApiOperation(value = "获取视频内容详情(审核详情使用)", notes = "获取视频内容详情(审核详情使用)")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "标识ID", dataType = "String", paramType = "path", required = true)
})
@GetMapping("/getAudit/{id}")
@RequiresAuthentication //@RequiresPermissions("video:content:get:id")
@MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.SELECT)
public Map<String, Object> getAuditInfoById(@PathVariable("id") String id) {
final VideoContent videoContent = JSONObject.parseObject(videoContentTmpService.getById(id).getData(), VideoContent.class);
if (videoContent.getVideoContentCatId() != null) {
VideoContentCat videoContentCat = this.videoContentCatService.getById(videoContent.getVideoContentCatId());
if (videoContentCat != null) {
videoContent.setVideoContentCatName(videoContentCat.getName());
}
}
if (videoContent.getVideoContentCopyrightOwnerId() != null) {
CopyrightOwner copyrightOwner = this.copyrightOwnerService.getById(videoContent.getVideoContentCopyrightOwnerId());
if (copyrightOwner != null) {
videoContent.setVideoContentCopyrightOwnerName(copyrightOwner.getName());
}
}
final LambdaQueryWrapper<AssetTmp> assetQueryWrapper = Wrappers.<AssetTmp>lambdaQuery().eq(AssetTmp::getRefItemId, id);
assetQueryWrapper.eq(AssetTmp::getFileCat, FileCatEnum.VIDEO_CONTENT.name());
final List<AssetTmp> videoFileList = this.assetTmpService.list(assetQueryWrapper);
videoContent.setVideoFileTmpList(videoFileList);
videoContent.setVideoFileIdList(videoFileList.stream().map(AssetTmp::getId).collect(Collectors.toList()));
final LambdaQueryWrapper<Audit> auditQueryWrapper = Wrappers.<Audit>lambdaQuery().eq(Audit::getRefItemId, id);
auditQueryWrapper.select(Audit::getContent);
auditQueryWrapper.select(Audit::getType);
auditQueryWrapper.select(Audit::getOperation);
auditQueryWrapper.select(Audit::getStatus);
auditQueryWrapper.select(Audit::getFirstTime);
auditQueryWrapper.select(Audit::getFirstRemarks);
auditQueryWrapper.select(Audit::getSecondTime);
auditQueryWrapper.select(Audit::getSecondTime);
auditQueryWrapper.select(Audit::getLevel);
final List<Audit> auditList = this.auditService.list(auditQueryWrapper);
videoContent.setAuditHistoryList(auditList);
return getResult(videoContent);
}
@DeleteMapping("/delete/{id}")
@RequiresAuthentication //@RequiresPermissions("video:content:delete")
@ApiOperation(value = "根据ID删除视频内容", notes = "根据ID删除视频内容")
......@@ -349,7 +313,6 @@ public class VideoContentController extends BaseController {
.type(AuditTypeEnum.VIDEO_CONTENT.name())
.operation(AuditOperationEnum.REMOVE.name())
.status(AuditStatusEnum.TBC.name())
.deleted(false)
.level(AuditStatusEnum.TBC.name())
.build();
final boolean result = this.auditService.save(audit);
......
......@@ -15,7 +15,6 @@
<result column="create_time" property="createTime"/>
<result column="first_time" property="firstTime"/>
<result column="second_time" property="secondTime"/>
<result column="is_deleted" property="deleted"/>
<result column="first_remarks" property="firstRemarks"/>
<result column="second_remarks" property="secondRemarks"/>
<result column="level" property="level"/>
......@@ -40,7 +39,6 @@
<if test="user.orgCode != null and user.orgCode != ''">
and o.code LIKE concat(#{user.orgCode}, '%')
</if>
and a.is_deleted = false
and a.type = 'ACCOUNT'
and a.operation = 'DISABLE'
order by a.create_time desc
......
......@@ -40,7 +40,7 @@
</select>
<select id="selectBoxPage" resultMap="BaseResultMap">
select b.id,b.organ_id,b.mac,b.status,b.area_id,b.create_time,b.update_time,u.user_name organ_name,a.full_name area_name,u.permanent permanent,
select b.id,b.organ_id,b.mac,b.status,b.area_id,b.private_key,b.create_time,b.update_time,u.user_name organ_name,a.full_name area_name,u.permanent permanent,
u.effective_date effective_date,u.exired_date exired_date
from t_box_operation b
left join t_organ o on b.organ_id = o.id
......@@ -63,7 +63,7 @@
</select>
<select id="selectPageList" resultMap="BaseResultMap">
SELECT b.id,b.organ_id,b.mac,b.status,b.area_id,b.create_time,b.update_time,u.user_name organ_name
SELECT b.id,b.organ_id,b.mac,b.status,b.area_id,b.private_key,b.create_time,b.update_time,u.user_name organ_name
FROM t_box_operation b
left join t_organ r on r.id = b.organ_id
left join t_user u on u.org_id = b.organ_id and u.type = '3'
......
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