Merge branch 'feature/bug-332' into develop

This commit is contained in:
曹鹏飞 2025-08-26 14:40:45 +08:00
commit 0904f2ed8c
4 changed files with 8 additions and 16 deletions

View File

@ -152,17 +152,15 @@ public class ProductCaseServiceImpl extends ServiceImpl<ProductCaseMapper, Produ
@Override
public void publish(BatchPublishRequest request) {
List<ProductCase> list = listByIds(request.getIds());
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductCase::getTitle).collect(Collectors.toList());
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
.throwMessage("以下案例不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + "" + StrUtil.join(",", names));
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
names = list.stream().filter(ph -> !ph.getEnable()).map(ProductCase::getTitle).collect(Collectors.toList());
List<String> names = list.stream().filter(ph -> !ph.getEnable()).map(ProductCase::getTitle).collect(Collectors.toList());
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下案例被禁用不能发布:" + StrUtil.join(",", names));
}
list.forEach(it -> publish(it, request.getState()));
}
private void publish(ProductCase info, Integer state) {
if (Objects.equals(state, info.getState())) return;
if (Objects.equals(state, PublishState.Published.getState())) {
info.setState(PublishState.Published.getState());
info.setPublishBy(AdminUserUtil.getUserName());

View File

@ -111,17 +111,15 @@ public class ProductHonorServiceImpl extends ServiceImpl<ProductHonorMapper, Pro
@Override
public void publish(BatchPublishRequest request) {
List<ProductHonor> list = listByIds(request.getIds());
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductHonor::getTitle).collect(Collectors.toList());
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
.throwMessage("以下荣誉不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + "" + StrUtil.join(",", names));
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
names = list.stream().filter(ph -> !ph.getEnable()).map(ProductHonor::getTitle).collect(Collectors.toList());
List<String> names = list.stream().filter(ph -> !ph.getEnable()).map(ProductHonor::getTitle).collect(Collectors.toList());
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下荣誉被禁用不能发布:" + StrUtil.join(",", names));
}
list.forEach(it -> publish(it, request.getState()));
}
private void publish(ProductHonor info, Integer state) {
if (Objects.equals(state, info.getState())) return;
if (Objects.equals(state, PublishState.Published.getState())) {
info.setState(PublishState.Published.getState());
info.setPublishBy(AdminUserUtil.getUserName());

View File

@ -93,17 +93,15 @@ public class ProductModelImageServiceImpl extends ServiceImpl<ProductModelImageM
@Override
public void publish(BatchPublishRequest request) {
List<ProductModelImage> list = listByIds(request.getIds());
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductModelImage::getName).collect(Collectors.toList());
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
.throwMessage("以下图片不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + "" + StrUtil.join(",", names));
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
names = list.stream().filter(ph -> !ph.getEnable()).map(ProductModelImage::getName).collect(Collectors.toList());
List<String> names = list.stream().filter(ph -> !ph.getEnable()).map(ProductModelImage::getName).collect(Collectors.toList());
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下图片被禁用不能发布:" + StrUtil.join(",", names));
}
list.forEach(it -> publish(it, request.getState()));
}
private void publish(ProductModelImage info, Integer state) {
if (Objects.equals(state, info.getState())) return;
if (Objects.equals(state, PublishState.Published.getState())) {
VUtils.trueThrowBusinessError(!info.getEnable()).throwMessage("不能发布已禁用的数据");
info.setState(PublishState.Published.getState());

View File

@ -114,17 +114,15 @@ public class ProductModelVideoServiceImpl extends ServiceImpl<ProductModelVideoM
@Override
public void publish(BatchPublishRequest request) {
List<ProductModelVideo> list = listByIds(request.getIds());
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductModelVideo::getName).collect(Collectors.toList());
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
.throwMessage("以下视频不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + "" + StrUtil.join(",", names));
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
names = list.stream().filter(ph -> !ph.getEnable()).map(ProductModelVideo::getName).collect(Collectors.toList());
List<String> names = list.stream().filter(ph -> !ph.getEnable()).map(ProductModelVideo::getName).collect(Collectors.toList());
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下视频被禁用不能发布:" + StrUtil.join(",", names));
}
list.forEach(it -> publish(it, request.getState()));
}
private void publish(ProductModelVideo info, Integer state) {
if (Objects.equals(state, info.getState())) return;
if (Objects.equals(state, PublishState.Published.getState())) {
info.setState(PublishState.Published.getState());
info.setPublishBy(AdminUserUtil.getUserName());