Commit 26576174 authored by nie'hong's avatar nie'hong

修改-在复审通过后再修改学习内容下的展板参考资料再app端显示

parent f327aed7
...@@ -19,9 +19,11 @@ import org.apache.commons.lang3.StringUtils; ...@@ -19,9 +19,11 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -70,6 +72,9 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -70,6 +72,9 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
@Resource @Resource
private LearningContentAssetService learningContentAssetService; private LearningContentAssetService learningContentAssetService;
@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));
...@@ -543,6 +548,28 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -543,6 +548,28 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
} }
one.setAuditStatus(audit.getStatus()); one.setAuditStatus(audit.getStatus());
update = this.learningContentService.updateById(one); update = this.learningContentService.updateById(one);
// 修改学习内容下的展板参考资料在app显示
LambdaUpdateWrapper<LearningContentAsset> updateWrapper = Wrappers.lambdaUpdate();
updateWrapper.eq(LearningContentAsset::getLearningContentId, one.getId());
// 删除原有信息
this.learningContentAssetService.remove(updateWrapper);
// 新增
List<String> fileList = learningContent.getFileList();
if (!CollectionUtils.isEmpty(fileList)) {
LambdaQueryWrapper<Asset> queryWrapper = Wrappers.<Asset>lambdaQuery().in(Asset::getId, fileList);
List<Asset> list1 = this.assetService.list(queryWrapper);
ArrayList<LearningContentAsset> learningContentAssets = new ArrayList<>();
list1.forEach(asset -> {
LearningContentAsset learningContentAsset = LearningContentAsset.builder()
.learningContentId(learningContent.getId())
.boardId(asset.getRefItemId())
.assetId(asset.getId())
.build();
learningContentAssets.add(learningContentAsset);
});
this.learningContentAssetService.saveBatch(learningContentAssets);
}
break; break;
default: default:
} }
......
...@@ -246,38 +246,6 @@ public class LearningContentController extends BaseController { ...@@ -246,38 +246,6 @@ public class LearningContentController extends BaseController {
} }
} }
// 学习内容下显示的参考信息被修改
LambdaQueryWrapper<LearningContentAsset> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.eq(LearningContentAsset::getLearningContentId,one.getId());
lambdaQuery.select(LearningContentAsset::getAssetId);
List<String> list = this.learningContentAssetService.listObjs(lambdaQuery, Object::toString);
if (!ListUtil.compareValue(list, learningContent.getFileList())) {
LambdaUpdateWrapper<LearningContentAsset> updateWrapper = Wrappers.lambdaUpdate();
updateWrapper.eq(LearningContentAsset::getLearningContentId, one.getId());
// 删除原有信息
this.learningContentAssetService.remove(updateWrapper);
// 新增
List<String> fileList = learningContent.getFileList();
if (!CollectionUtils.isEmpty(fileList)) {
LambdaQueryWrapper<Asset> queryWrapper = Wrappers.<Asset>lambdaQuery().in(Asset::getId, fileList);
List<Asset> list1 = this.assetService.list(queryWrapper);
ArrayList<LearningContentAsset> learningContentAssets = new ArrayList<>();
list1.forEach(asset -> {
LearningContentAsset learningContentAsset = LearningContentAsset.builder()
.learningContentId(learningContent.getId())
.boardId(asset.getRefItemId())
.assetId(asset.getId())
.build();
learningContentAssets.add(learningContentAsset);
});
boolean b = this.learningContentAssetService.saveBatch(learningContentAssets);
if (!b) {
return getFailResult("更新数据失败!");
}
}
}
one.setAuditStatus(AuditStatusEnum.TBC.name()); one.setAuditStatus(AuditStatusEnum.TBC.name());
this.learningContentService.updateById(one); this.learningContentService.updateById(one);
......
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